1From 09cc01b2fa15e319afafa13d7365b399a60f443c Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 3 Jan 2023 13:36:01 -0800
4Subject: [PATCH] timeSync: Portable way to print 64bit time_t
5
6This ensures when 64bit time_t is used on 32bit architectures (
7-D_TIME_BITS=64 ) then it can print it correctly as well.
8
9Fixes
10pllLinux.c:43:20: error: format specifies type 'long' but the argument has type 'long long' [-Werror,-Wformat]
11|            prefix, tx->offset, tx->freq, tx->maxerror, tx->esterror,
12|                    ^~~~~~~~~~
13
14Upstream-Status: Submitted [https://github.com/vmware/open-vm-tools/pull/631]
15
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17---
18 open-vm-tools/services/plugins/timeSync/pllLinux.c  | 8 ++++----
19 open-vm-tools/services/plugins/timeSync/slewLinux.c | 2 +-
20 2 files changed, 5 insertions(+), 5 deletions(-)
21
22diff --git a/open-vm-tools/services/plugins/timeSync/pllLinux.c b/open-vm-tools/services/plugins/timeSync/pllLinux.c
23index e9c8e61de..90ba8c63f 100644
24--- a/open-vm-tools/services/plugins/timeSync/pllLinux.c
25+++ b/open-vm-tools/services/plugins/timeSync/pllLinux.c
26@@ -38,10 +38,10 @@
27 static void
28 TimeSyncLogPLLState(const char *prefix, struct timex *tx)
29 {
30-   g_debug("%s : off %ld freq %ld maxerr %ld esterr %ld status %d "
31-           "const %ld precision %ld tolerance %ld tick %ld\n",
32-           prefix, tx->offset, tx->freq, tx->maxerror, tx->esterror,
33-           tx->status, tx->constant, tx->precision, tx->tolerance, tx->tick);
34+   g_debug("%s : off %jd freq %jd maxerr %jd esterr %jd status %d "
35+           "const %jd precision %jd tolerance %jd tick %jd\n",
36+           prefix, (intmax_t)tx->offset, (intmax_t)tx->freq, (intmax_t)tx->maxerror, (intmax_t)tx->esterror,
37+           tx->status, (intmax_t)tx->constant, (intmax_t)tx->precision, (intmax_t)tx->tolerance, (intmax_t)tx->tick);
38 }
39
40 /*
41diff --git a/open-vm-tools/services/plugins/timeSync/slewLinux.c b/open-vm-tools/services/plugins/timeSync/slewLinux.c
42index 1ab6e3584..0c304b5d7 100644
43--- a/open-vm-tools/services/plugins/timeSync/slewLinux.c
44+++ b/open-vm-tools/services/plugins/timeSync/slewLinux.c
45@@ -156,6 +156,6 @@ TimeSync_Slew(int64 delta,
46       g_debug("adjtimex failed: %s\n", strerror(errno));
47       return FALSE;
48    }
49-   g_debug("time slew start: %ld\n", tx.tick);
50+   g_debug("time slew start: %jd\n", (intmax_t)tx.tick);
51    return TRUE;
52 }
53--
542.25.1
55
56