Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/env_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ const std::string scribeversion("2.2");
time(&now); \
ctime_r(&now, dbgtime); \
dbgtime[24] = '\0'; \
fprintf(stderr,"[%s] " #format_string " \n", dbgtime,##__VA_ARGS__); \
struct timeval tv; \
gettimeofday(&tv, NULL); \
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This introduces one extra call. Try the following:

  • first call gettimeofday()
  • take tv.sec and pass it to ctime_r()
  • together print sec and millisec parts

long numMillis = (tv.tv_usec / 1000); \
fprintf(stderr,"[%s %ld] " #format_string " \n", dbgtime,numMillis,##__VA_ARGS__); \
}


Expand Down