]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Make the delta between 1970 and 1900 a 64-bit signed integral constant.
authorGuy Harris <[email protected]>
Thu, 21 Sep 2017 17:05:33 +0000 (10:05 -0700)
committerGuy Harris <[email protected]>
Thu, 21 Sep 2017 17:05:33 +0000 (10:05 -0700)
It doesn't fit in a 32-bit signed integral constant, so make sure it's
64-bit; the only use is to subtract it from a 64-bit signed integral
value.

netdissect-stdinc.h
print-ntp.c

index 9b88ce9e0730c6eb7c76c3bab2c1bcbdee0613db..343e13c0e5afd9b9b1b26faac53abccea52ab623 100644 (file)
 #include <fcntl.h>
 #include <sys/types.h>
 
 #include <fcntl.h>
 #include <sys/types.h>
 
+#ifdef _MSC_VER
+  /*
+   * Compiler is MSVC.
+   *
+   * Microsoft's documentation doesn't speak of LL as a valid
+   * suffix for 64-bit integers, so we'll just use i64.
+   */
+  #define INT64_T_CONSTANT(constant)   (constant##i64)
+#else
+  /*
+   * Non-Microsoft compiler; assume LL works.
+   */
+  #define INT64_T_CONSTANT(constant)   (constant##LL)
+#endif
+
 #ifdef _MSC_VER
 #define stat _stat
 #define open _open
 #ifdef _MSC_VER
 #define stat _stat
 #define open _open
@@ -223,6 +238,11 @@ typedef char* caddr_t;
 
 #include <arpa/inet.h>
 
 
 #include <arpa/inet.h>
 
+/*
+ * Assume LL works.
+ */
+#define INT64_T_CONSTANT(constant)     (constant##LL)
+
 #endif /* _WIN32 */
 
 #ifndef HAVE___ATTRIBUTE__
 #endif /* _WIN32 */
 
 #ifndef HAVE___ATTRIBUTE__
index cf403c0c0472fa843efd028b0a18a05fc191a069..55d2690761207e530ca3d9642937a629e14f30fe 100644 (file)
@@ -48,7 +48,7 @@ static const char tstr[] = " [|ntp]";
 /*
  *  Definitions for the masses
  */
 /*
  *  Definitions for the masses
  */
-#define        JAN_1970        2208988800      /* 1970 - 1900 in seconds */
+#define        JAN_1970        INT64_T_CONSTANT(2208988800)    /* 1970 - 1900 in seconds */
 
 /*
  * Structure definitions for NTP fixed point values
 
 /*
  * Structure definitions for NTP fixed point values