mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
logger: clamp the log time to 5 digits
In the interested of making the logs narrower, let's drop some digits from the clock_gettime() seconds value. Clamping to 5 digigts, this gives us just under 28h before we wrap which is likely good enough for debugging.
This commit is contained in:
parent
9737d6e3da
commit
1c083a6d69
1 changed files with 3 additions and 4 deletions
|
|
@ -78,7 +78,7 @@ impl_log_logv(void *object,
|
|||
#define RESERVED_LENGTH 24
|
||||
|
||||
struct impl *impl = object;
|
||||
char timestamp[19] = {0};
|
||||
char timestamp[14] = {0};
|
||||
char filename[64] = {0};
|
||||
char location[1000 + RESERVED_LENGTH], *p, *s;
|
||||
static const char *levels[] = { "-", "E", "W", "I", "D", "T", "*T*" };
|
||||
|
|
@ -106,9 +106,8 @@ impl_log_logv(void *object,
|
|||
if (impl->timestamp) {
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC_RAW, &now);
|
||||
spa_scnprintf(timestamp, sizeof(timestamp), "[%09lu.%06lu]",
|
||||
now.tv_sec & 0x1FFFFFFF, now.tv_nsec / 1000);
|
||||
|
||||
spa_scnprintf(timestamp, sizeof(timestamp), "[%05lu.%06lu]",
|
||||
(now.tv_sec & 0x1FFFFFFF) % 100000, now.tv_nsec / 1000);
|
||||
}
|
||||
if (impl->line && line != 0) {
|
||||
s = strrchr(file, '/');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue