summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bkisofs/bkMisc.c')
-rw-r--r--lib/bkisofs/bkMisc.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/bkisofs/bkMisc.c b/lib/bkisofs/bkMisc.c
new file mode 100644
index 0000000..eedba7d
--- /dev/null
+++ b/lib/bkisofs/bkMisc.c
@@ -0,0 +1,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;
+ }
+}