pretty things up a bit

This commit is contained in:
philippe44
2023-03-29 23:41:35 -07:00
parent cad286c8d7
commit 5ecb371fb0
3 changed files with 13 additions and 8 deletions

View File

@@ -69,7 +69,11 @@ const char *logtime(void) {
struct timeval tv;
gettimeofday(&tv, NULL);
strftime(buf, sizeof(buf), "[%T.", localtime(&tv.tv_sec));
sprintf(buf+strlen(buf), "%06ld]", (long)tv.tv_usec);
#ifdef EMBEDDED
sprintf(buf+strlen(buf), "%03ld]", (long)tv.tv_usec/1000);
#else
sprintf(buf+strlen(buf), "%06ld]", (long)tv.tv_usec);
#endif
#endif
return buf;
}