Skip to content

Commit

Permalink
Use CLOCK_BOOTTIME as clock source when logging to stderr
Browse files Browse the repository at this point in the history
Previously CLOCK_MONOTONIC was used, but monotonic time does not advance
when the device is suspended and thus is not ideal for debugging issues
involving suspend.
  • Loading branch information
spiiroin committed Feb 11, 2014
1 parent aeb6c0b commit adacd21
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mce-log.c
Expand Up @@ -42,14 +42,16 @@ static char *logname = NULL;
static void monotime(struct timeval *tv)
{
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
clock_gettime(CLOCK_BOOTTIME, &ts);
TIMESPEC_TO_TIMEVAL(tv, &ts);
}
static void timestamp(struct timeval *tv)
{
static struct timeval start, prev;
struct timeval diff;
monotime(tv);
if( !timerisset(&start) )
prev = start = *tv;
timersub(tv, &prev, &diff);
if( diff.tv_sec >= 4 ) {
timersub(tv, &start, &diff);
Expand Down

0 comments on commit adacd21

Please sign in to comment.