[Git][NTPsec/ntpsec][master] Use a C99 int64 printing type now that bump is an int64

Matt Selsky gitlab at mg.gitlab.com
Thu Apr 5 05:33:47 UTC 2018


Matt Selsky pushed to branch master at NTPsec / ntpsec


Commits:
efdc4f82 by Matt Selsky at 2018-04-04T06:05:44Z
Use a C99 int64 printing type now that bump is an int64

Avoid warnings like:
../../ntpfrob/bumpclock.c:26:52: warning: format specifies type 'long' but the argument has type 'int64_t' (aka 'long long') [-Wformat]
    printf("Bumping clock by %ld microseconds.\n", bump);
                             ~~~                   ^~~~
                             %lld
1 warning generated.

Introduced in "Fix ntpfrob/bumpclock to work with large values."

- - - - -


1 changed file:

- ntpfrob/bumpclock.c


Changes:

=====================================
ntpfrob/bumpclock.c
=====================================
--- a/ntpfrob/bumpclock.c
+++ b/ntpfrob/bumpclock.c
@@ -11,6 +11,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
+#include <inttypes.h>
 
 #include "ntpfrob.h"
 
@@ -22,11 +23,7 @@ void bumpclock(int64_t bump)
     int rc1, rc2, rc3;
     int er1, er2, er3;
 
-#if NTP_SIZEOF_LONG > 4
-    printf("Bumping clock by %ld microseconds.\n", bump);
-#else
-    printf("Bumping clock by %lld microseconds.\n", bump);
-#endif
+    printf("Bumping clock by %" PRId64 " microseconds.\n", bump);
 
     rc1 = clock_gettime(CLOCK_REALTIME, &was);
     er1 = errno;



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/efdc4f82a9d29a73fe7d617ceda205b4bb9376e8

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/efdc4f82a9d29a73fe7d617ceda205b4bb9376e8
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20180405/7361fdf6/attachment.html>


More information about the vc mailing list