mirror of
https://github.com/troglobit/finit.git
synced 2026-10-16 10:39:35 +00:00
Set time value before using it!
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
This commit is contained in:
1 parent
efcdc141c8
commit
367049a11c
1 file changed
+3
-2
+3
-2
@@ -146,6 +146,8 @@ void _d(char *fmt, ...)
|
||||
|
||||
va_start(ap, fmt);
|
||||
|
||||
gettimeofday(&t, NULL);
|
||||
|
||||
s = t.tv_sec - t0.tv_sec;
|
||||
ms = (t.tv_usec - t0.tv_usec) / 1000;
|
||||
if (ms < 0) {
|
||||
@@ -153,8 +155,7 @@ void _d(char *fmt, ...)
|
||||
s -= 1;
|
||||
}
|
||||
|
||||
gettimeofday(&t, NULL);
|
||||
printf("[%ld.%03ld] ", s, ms);
|
||||
printf("[%d.%03d] ", s, ms);
|
||||
vprintf(fmt, ap);
|
||||
printf("\n");
|
||||
va_end(ap);
|
||||
|
||||
Reference in new issue
Block a user