summaryrefslogtreecommitdiff
blob: eedba7daee9341ec4cfbe336a68bcf7c5207633a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/******************************* LICENCE **************************************
* Any code in this file may be redistributed or modified under the terms of
* the GNU General Public Licence as published by the Free Software 
* Foundation; version 2 of the licence.
****************************** END LICENCE ***********************************/

/******************************************************************************
* Author:
* Andrew Smith, http://littlesvr.ca/misc/contactandrew.php
*
* Contributors:
* 
******************************************************************************/

#include <time.h>

#include "bkInternal.h"
#include "bkMisc.h"

void maybeUpdateProgress(VolInfo* volInfo)
{
    struct timeb timeNow;
    
    if(volInfo->progressFunction == NULL)
        return;
    
    ftime(&timeNow);
    
    if(timeNow.time - volInfo->lastTimeCalledProgress.time >= 1 ||
       timeNow.millitm - volInfo->lastTimeCalledProgress.millitm >= 100)
    {
        volInfo->progressFunction(volInfo);
        
        volInfo->lastTimeCalledProgress = timeNow;
    }
}