blob: 85ce2b762d6e54507d5b7a77d502bde1bbef41f7 [file] [log] [blame]
Andrew Geisslerc723b722021-01-08 16:14:09 -06001From fa360ca8a457dafcae1d22df2b342d3ee291e8af Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 31 Dec 2020 14:28:39 -0800
4Subject: [PATCH 2/2] Always use 64bit to print time_t
5
6some 32bit architectures e.g. RISCV32 use 64bit time_t from beginning
7which does not fit into long int size on LP32 systems
8
9Upstream-Status: Submitted [https://github.com/ccache/ccache/pull/762]
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 src/Logging.cpp | 5 ++++-
13 1 file changed, 4 insertions(+), 1 deletion(-)
14
15diff --git a/src/Logging.cpp b/src/Logging.cpp
16index 9a5d99b7..1a6e6264 100644
17--- a/src/Logging.cpp
18+++ b/src/Logging.cpp
19@@ -88,7 +88,10 @@ do_log(string_view message, bool bulk)
20 if (tm) {
21 strftime(timestamp, sizeof(timestamp), "%Y-%m-%dT%H:%M:%S", &*tm);
22 } else {
23- snprintf(timestamp, sizeof(timestamp), "%lu", tv.tv_sec);
24+ snprintf(timestamp,
25+ sizeof(timestamp),
26+ "%llu",
27+ (long long unsigned int)tv.tv_sec);
28 }
29 snprintf(prefix,
30 sizeof(prefix),
31--
322.30.0
33