mirror of
https://github.com/rkujawa/rk65c02.git
synced 2025-01-10 03:29:46 +00:00
Use clock_gettime instead of gettimeofday.
This commit is contained in:
parent
262321b363
commit
e72871a5b6
11
src/log.c
11
src/log.c
@ -1,7 +1,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "log.h"
|
||||
|
||||
@ -24,14 +23,14 @@ void rk65c02_loglevel_set(uint8_t l)
|
||||
void rk65c02_log(uint8_t l, const char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
struct timeval t;
|
||||
|
||||
gettimeofday(&t, NULL);
|
||||
struct timespec t;
|
||||
|
||||
if (l > level)
|
||||
return;
|
||||
|
||||
fprintf(stderr, "%ld %s:\t", (t.tv_sec * 1000000 + t.tv_usec),
|
||||
clock_gettime(CLOCK_REALTIME, &t);
|
||||
|
||||
fprintf(stderr, "%ld.%ld %s:\t", t.tv_sec, t.tv_nsec,
|
||||
level_str[l]);
|
||||
|
||||
va_start(args, fmt);
|
||||
|
Loading…
x
Reference in New Issue
Block a user