mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
tests: check strftime result
This commit is contained in:
parent
352b1b1817
commit
cf6cbfb7f7
@ -322,7 +322,7 @@ struct Journal {
|
||||
char buf[64];
|
||||
time_t t = time( 0 );
|
||||
if (localtime_r(&t, &time_info)) {
|
||||
strftime(buf, sizeof(buf), "%F %T", &time_info);
|
||||
if ( strftime( buf, sizeof(buf), "%F %T", &time_info ) )
|
||||
of << "--- " << buf << " ---";
|
||||
}
|
||||
}
|
||||
@ -716,7 +716,7 @@ struct KMsg : Source {
|
||||
unsigned level, num, pos;
|
||||
unsigned long t;
|
||||
time_t tt;
|
||||
size_t len;
|
||||
size_t len, slen;
|
||||
const char *delimiter;
|
||||
|
||||
buf[ *sz ] = 0;
|
||||
@ -728,8 +728,10 @@ struct KMsg : Source {
|
||||
memcpy( newbuf, buf, *sz );
|
||||
tt = time( 0 );
|
||||
len = snprintf( buf, 64, "[%lu.%06lu] <%u> ", t / 1000000, t % 1000000, level );
|
||||
if ( localtime_r( &tt, &time_info ) )
|
||||
len += strftime( buf + len, 64, "%F %T ", &time_info );
|
||||
if ( localtime_r( &tt, &time_info ) &&
|
||||
( slen = strftime( buf + len, 64, "%F %T ", &time_info ) ) )
|
||||
len += slen;
|
||||
|
||||
memcpy( buf + len, newbuf + pos, *sz - pos );
|
||||
*sz = *sz - pos + len;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user