aboutgitcodebugslistschat
path: root/log.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2024-07-24 17:39:55 +0200
committerStefano Brivio <sbrivio@redhat.com>2024-07-26 13:47:34 +0200
commite5c37ba0f419fd6c46d11ee9ec909b3fa9d2aa2f (patch)
treed281ab045a34e064bc7451238d99271e970c0716 /log.c
parent327d9d482fd4480ca16e993fe2699c8bbc166251 (diff)
downloadpasst-e5c37ba0f419fd6c46d11ee9ec909b3fa9d2aa2f.tar
passt-e5c37ba0f419fd6c46d11ee9ec909b3fa9d2aa2f.tar.gz
passt-e5c37ba0f419fd6c46d11ee9ec909b3fa9d2aa2f.tar.bz2
passt-e5c37ba0f419fd6c46d11ee9ec909b3fa9d2aa2f.tar.lz
passt-e5c37ba0f419fd6c46d11ee9ec909b3fa9d2aa2f.tar.xz
passt-e5c37ba0f419fd6c46d11ee9ec909b3fa9d2aa2f.tar.zst
passt-e5c37ba0f419fd6c46d11ee9ec909b3fa9d2aa2f.zip
log: Initialise timestamp for relative log time also if we use a log file
...not just for debug messages. Otherwise, timestamps in the log file are consistent but the starting point is not zero. Do this right away as we enter main(), so that the resulting timestamps are as closely as possible relative to when we start. Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'log.c')
-rw-r--r--log.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/log.c b/log.c
index 32157a8..9474bad 100644
--- a/log.c
+++ b/log.c
@@ -40,7 +40,7 @@ static size_t log_written; /* Currently used bytes in log file */
static size_t log_cut_size; /* Bytes to cut at start on rotation */
static char log_header[BUFSIZ]; /* File header, written back on cuts */
-static struct timespec log_start; /* Start timestamp */
+struct timespec log_start; /* Start timestamp */
int log_trace; /* --trace mode enabled */
bool log_conf_parsed; /* Logging options already parsed */
@@ -154,8 +154,6 @@ void __openlog(const char *ident, int option, int facility)
{
(void)option;
- clock_gettime(CLOCK_REALTIME, &log_start);
-
if (log_sock < 0) {
struct sockaddr_un a = { .sun_family = AF_UNIX, };