BUGFIX:
authorgkostka <kostka.grzegorz@gmail.com>
Sun, 27 Oct 2013 13:17:24 +0000 (13:17 +0000)
committergkostka <kostka.grzegorz@gmail.com>
Sun, 27 Oct 2013 13:17:24 +0000 (13:17 +0000)
1. Timing function update.

demos/generic/main.c

index 085b2edfcf4bc4d81cfdac7a6e0911816fa15333..9bcf80d4778316ba267cd70e5f2552ccb573c1aa 100644 (file)
 #include <getopt.h>\r
 #include <stdbool.h>\r
 #include <time.h>\r
+#include <unistd.h>\r
 \r
 #include <ext4_filedev.h>\r
 #include <io_raw.h>\r
 #include <ext4.h>\r
 \r
+#ifdef WIN32\r
+#include <windows.h>\r
+#endif\r
+\r
 /**@brief   Input stream name.*/\r
 char input_name[128] = "ext2";\r
 \r
@@ -202,7 +207,9 @@ static void block_stats(void)
 \r
 static clock_t get_ms(void)\r
 {\r
-    return (clock() * 1000) / (CLOCKS_PER_SEC);\r
+    struct timeval t;\r
+    gettimeofday(&t);\r
+    return (t.tv_sec * 1000) + (t.tv_usec / 1000);\r
 }\r
 \r
 static bool dir_test(int len)\r