mirror of
https://github.com/troglobit/finit.git
synced 2026-11-21 19:51:46 +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);
|
va_start(ap, fmt);
|
||||||
|
|
||||||
|
gettimeofday(&t, NULL);
|
||||||
|
|
||||||
s = t.tv_sec - t0.tv_sec;
|
s = t.tv_sec - t0.tv_sec;
|
||||||
ms = (t.tv_usec - t0.tv_usec) / 1000;
|
ms = (t.tv_usec - t0.tv_usec) / 1000;
|
||||||
if (ms < 0) {
|
if (ms < 0) {
|
||||||
@@ -153,8 +155,7 @@ void _d(char *fmt, ...)
|
|||||||
s -= 1;
|
s -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
gettimeofday(&t, NULL);
|
printf("[%d.%03d] ", s, ms);
|
||||||
printf("[%ld.%03ld] ", s, ms);
|
|
||||||
vprintf(fmt, ap);
|
vprintf(fmt, ap);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|||||||
Reference in new issue
Block a user