shithub: lwext4

Download patch

ref: b0df6d36f11be07a46bce904489624e530d8618c
parent: 15a9dcc5906882478a0328552acb0403d0625673
author: gkostka <kostka.grzegorz@gmail.com>
date: Sun Oct 27 09:17:24 EDT 2013

BUGFIX:
1. Timing function update.

--- a/demos/generic/main.c
+++ b/demos/generic/main.c
@@ -33,11 +33,16 @@
 #include <getopt.h>
 #include <stdbool.h>
 #include <time.h>
+#include <unistd.h>
 
 #include <ext4_filedev.h>
 #include <io_raw.h>
 #include <ext4.h>
 
+#ifdef WIN32
+#include <windows.h>
+#endif
+
 /**@brief   Input stream name.*/
 char input_name[128] = "ext2";
 
@@ -202,7 +207,9 @@
 
 static clock_t get_ms(void)
 {
-    return (clock() * 1000) / (CLOCKS_PER_SEC);
+    struct timeval t;
+    gettimeofday(&t);
+    return (t.tv_sec * 1000) + (t.tv_usec / 1000);
 }
 
 static bool dir_test(int len)