mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-05 20:45:49 +01:00
log milliseconds: seconds not enough.
This commit is contained in:
parent
45bb36e66c
commit
e485af925f
1 changed files with 4 additions and 5 deletions
|
@ -124,8 +124,6 @@ logf( XW_LogLevel level, const char* format, ... )
|
|||
va_end(ap);
|
||||
#else
|
||||
FILE* where = NULL;
|
||||
struct tm* timp;
|
||||
struct timeval tv;
|
||||
bool useFile;
|
||||
char logFile[256];
|
||||
|
||||
|
@ -143,13 +141,14 @@ logf( XW_LogLevel level, const char* format, ... )
|
|||
|
||||
if ( !!where ) {
|
||||
static int tm_yday = 0;
|
||||
struct timeval tv;
|
||||
gettimeofday( &tv, NULL );
|
||||
struct tm result;
|
||||
timp = localtime_r( &tv.tv_sec, &result );
|
||||
struct tm* timp = localtime_r( &tv.tv_sec, &result );
|
||||
|
||||
char timeBuf[64];
|
||||
sprintf( timeBuf, "%.2d:%.2d:%.2d", timp->tm_hour,
|
||||
timp->tm_min, timp->tm_sec );
|
||||
sprintf( timeBuf, "%.2d:%.2d:%.2d.%03ld", timp->tm_hour,
|
||||
timp->tm_min, timp->tm_sec, tv.tv_usec / 1000 );
|
||||
|
||||
/* log the date once/day. This isn't threadsafe so may be
|
||||
repeated but that's harmless. */
|
||||
|
|
Loading…
Add table
Reference in a new issue