summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/ccache/ccache/0002-Always-use-64bit-to-print-time_t.patch
blob: 85ce2b762d6e54507d5b7a77d502bde1bbef41f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From fa360ca8a457dafcae1d22df2b342d3ee291e8af Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 31 Dec 2020 14:28:39 -0800
Subject: [PATCH 2/2] Always use 64bit to print time_t

some 32bit architectures e.g. RISCV32 use 64bit time_t from beginning
which does not fit into long int size on LP32 systems

Upstream-Status: Submitted [https://github.com/ccache/ccache/pull/762]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 src/Logging.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/Logging.cpp b/src/Logging.cpp
index 9a5d99b7..1a6e6264 100644
--- a/src/Logging.cpp
+++ b/src/Logging.cpp
@@ -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),
-- 
2.30.0