mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-05-13 16:37:27 +00:00
Use monotonic() instead of time of day for logging
Time of day is verbose and I have never found it to be of any use
This commit is contained in:
parent
ede332fecf
commit
bb45062ef6
1 changed files with 1 additions and 11 deletions
|
|
@ -53,17 +53,7 @@ log_error(const char *fmt, ...) {
|
|||
END_ALLOW_CASE_RANGE
|
||||
|
||||
if (!use_os_log) { // Apple's os_log already records timestamps
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
struct tm stack_tmp;
|
||||
struct tm *tmp = localtime_r(&tv.tv_sec, &stack_tmp);
|
||||
if (tmp) {
|
||||
char tbuf[256] = {0}, buf[256] = {0};
|
||||
if (strftime(buf, sizeof(buf), "%j %H:%M:%S.%%06u", tmp) != 0) {
|
||||
snprintf(tbuf, sizeof(tbuf), buf, tv.tv_usec);
|
||||
fprintf(stderr, "[%s] ", tbuf);
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "[%.3f] ", monotonic_t_to_s_double(monotonic()));
|
||||
}
|
||||
#ifdef __APPLE__
|
||||
if (use_os_log) os_log(OS_LOG_DEFAULT, "%{public}s", sanbuf);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue