cross armhf tangle

Gary E. Miller gem at rellim.com
Tue Feb 4 02:56:11 UTC 2025


Yo Hal!

On Sun, 02 Feb 2025 20:40:43 -0800
Hal Murray <halmurray at sonic.net> wrote:

> The unobvious part is the code in wafhelpers/check_sizeof.py that
> handles the cross case for getting NTP_SIZEOF_TIME_T and friends.  

NTP_SIZEOF_TIME_T is in the code 5 times, in just 3 places.

./ntpd/ntp_leapsec.c:#if NTP_SIZEOF_TIME_T == 8
./ntpd/ntp_leapsec.c:#elif NTP_SIZEOF_TIME_T == 4
./libntp/timespecops.c:#if NTP_SIZEOF_TIME_T <= 4
./libntp/systime.c:#if NTP_SIZEOF_TIME_T > 4
./libntp/prettydate.c:#if NTP_SIZEOF_TIME_T < 4

Trivial to code that out.

Like this:

diff --git a/ntpd/ntp_leapsec.c b/ntpd/ntp_leapsec.c
index 272910100..1fbd657d9 100644
--- a/ntpd/ntp_leapsec.c
+++ b/ntpd/ntp_leapsec.c
@@ -83,12 +83,8 @@ static void   reset_times(leap_table_t*);
 static bool   leapsec_add(leap_table_t*, time_t, int);
 static bool   leapsec_raw(leap_table_t*, time_t, int, bool);
 
-/* time_t is unsigned.  This is used for infinity in tables */
-#if NTP_SIZEOF_TIME_T == 8
-# define LAST_time_t 0x7fffffffffffffff
-#elif NTP_SIZEOF_TIME_T == 4
-# define LAST_time_t 0x7fffffff
-#endif
+// time_t is unsigned.  This is used for infinity in tables
+#define LAST_time_t ((8 == sizeof(time_t))? 0x7fffffffffffffff : 0x7fffffff)
 



RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
	gem at rellim.com  Tel:+1 541 382 8588

	    Veritas liberabit vos. -- Quid est veritas?
    "If you can't measure it, you can't improve it." - Lord Kelvin


More information about the devel mailing list