The epoch was being defined as UL, which is fine for LP64, but too small
on LP32 for what we're trying to do.

toys/net/sntp.c:60:32: warning: left shift count >= width of type
   return ((tv.tv_sec+SEVENTIES)<<32)+(((long long)tv.tv_nsec)<<32)/1000000000;
                                ^~

(Android doesn't use this, I'm just fixing this too while I fix the
LP64isms I introduced in readelf...)
---
 toys/net/sntp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
From 3327c810d26c4c5131e28735096e057810e6c8d6 Mon Sep 17 00:00:00 2001
From: Elliott Hughes <[email protected]>
Date: Fri, 10 Jan 2020 14:12:18 -0800
Subject: [PATCH] sntp.c: fix 32-bit.

The epoch was being defined as UL, which is fine for LP64, but too small
on LP32 for what we're trying to do.

toys/net/sntp.c:60:32: warning: left shift count >= width of type
   return ((tv.tv_sec+SEVENTIES)<<32)+(((long long)tv.tv_nsec)<<32)/1000000000;
                                ^~

(Android doesn't use this, I'm just fixing this too while I fix the
LP64isms I introduced in readelf...)
---
 toys/net/sntp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/toys/net/sntp.c b/toys/net/sntp.c
index ab6a6031..0cb0b7b4 100644
--- a/toys/net/sntp.c
+++ b/toys/net/sntp.c
@@ -39,7 +39,7 @@ GLOBALS(
 )
 
 // Seconds from 1900 to 1970, including appropriate leap days
-#define SEVENTIES 2208988800UL
+#define SEVENTIES 2208988800ULL
 
 // Get time and return ntptime (saving timespec in pointer if not null)
 // NTP time is high 32 bits = seconds since 1970 (blame RFC 868), low 32 bits
-- 
2.25.0.rc1.283.g88dfdc4193-goog

_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to