Andrew Geissler | c723b72 | 2021-01-08 16:14:09 -0600 | [diff] [blame] | 1 | From fa360ca8a457dafcae1d22df2b342d3ee291e8af Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Thu, 31 Dec 2020 14:28:39 -0800 |
| 4 | Subject: [PATCH 2/2] Always use 64bit to print time_t |
| 5 | |
| 6 | some 32bit architectures e.g. RISCV32 use 64bit time_t from beginning |
| 7 | which does not fit into long int size on LP32 systems |
| 8 | |
| 9 | Upstream-Status: Submitted [https://github.com/ccache/ccache/pull/762] |
| 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 11 | --- |
| 12 | src/Logging.cpp | 5 ++++- |
| 13 | 1 file changed, 4 insertions(+), 1 deletion(-) |
| 14 | |
| 15 | diff --git a/src/Logging.cpp b/src/Logging.cpp |
| 16 | index 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 | -- |
| 32 | 2.30.0 |
| 33 | |