]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Always use 64bit to print time_t (#762)
authorKhem Raj <raj.khem@gmail.com>
Sun, 10 Jan 2021 20:43:47 +0000 (12:43 -0800)
committerGitHub <noreply@github.com>
Sun, 10 Jan 2021 20:43:47 +0000 (21:43 +0100)
some 32bit architectures e.g. RISCV32 use 64bit time_t from beginning
which does not fit into long int size on LP32 systems

Signed-off-by: Khem Raj <raj.khem@gmail.com>
src/Logging.cpp

index 9a5d99b7cc24296620e3800c09511ab24e182f4d..1a6e6264f5a1d92030410a58cae73927a8fedc4e 100644 (file)
@@ -88,7 +88,10 @@ do_log(string_view message, bool bulk)
     if (tm) {
       strftime(timestamp, sizeof(timestamp), "%Y-%m-%dT%H:%M:%S", &*tm);
     } else {
-      snprintf(timestamp, sizeof(timestamp), "%lu", tv.tv_sec);
+      snprintf(timestamp,
+               sizeof(timestamp),
+               "%llu",
+               (long long unsigned int)tv.tv_sec);
     }
     snprintf(prefix,
              sizeof(prefix),