diff options
Diffstat (limited to 'liblog/logprint.c')
| -rw-r--r-- | liblog/logprint.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/liblog/logprint.c b/liblog/logprint.c index 0ea2269ea..9f12c96db 100644 --- a/liblog/logprint.c +++ b/liblog/logprint.c @@ -203,7 +203,7 @@ AndroidLogFormat *android_log_format_new() p_ret->year_output = false; p_ret->zone_output = false; p_ret->epoch_output = false; - p_ret->monotonic_output = false; + p_ret->monotonic_output = android_log_timestamp() == 'm'; return p_ret; } @@ -1261,10 +1261,13 @@ char *android_log_formatLogLine ( now = entry->tv_sec; nsec = entry->tv_nsec; if (p_format->monotonic_output) { - struct timespec time; - convertMonotonic(&time, entry); - now = time.tv_sec; - nsec = time.tv_nsec; + // prevent convertMonotonic from being called if logd is monotonic + if (android_log_timestamp() != 'm') { + struct timespec time; + convertMonotonic(&time, entry); + now = time.tv_sec; + nsec = time.tv_nsec; + } } if (now < 0) { nsec = NS_PER_SEC - nsec; |
