You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

54 lines
1.5 KiB

--- a/adjtimex.c
+++ b/adjtimex.c
@@ -36,6 +36,7 @@
* gcc -Wall -O adjtimex_1.c -o adjtimex
*/
+#include <inttypes.h>
#include <stdio.h>
#include <sys/types.h>
#include <stdlib.h>
@@ -143,12 +144,12 @@ int main(int argc, char ** argv)
" precision: %ld\n"
" tolerance: %ld\n"
"-t tick: %ld\n"
- " time.tv_sec: %ld\n"
- " time.tv_usec: %ld\n"
+ " time.tv_sec: %" PRId64 "\n"
+ " time.tv_usec: %" PRId64 "\n"
" return value: %d (%s)\n",
txc.constant,
txc.precision, txc.tolerance, txc.tick,
- txc.time.tv_sec, txc.time.tv_usec, ret,
+ (int64_t)txc.time.tv_sec, (int64_t)txc.time.tv_usec, ret,
(ret >= 0 && ret <= 5) ? ret_code_descript[ret] : "error" );
}
return (ret<0);
--- a/ntpclient.c
+++ b/ntpclient.c
@@ -29,6 +29,7 @@
* labelled "XXX fixme - non-automatic build configuration".
*/
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -181,7 +182,7 @@ static void set_time(struct ntptime *new
exit(1);
}
if (debug) {
- printf("set time to %lu.%.9lu\n", tv_set.tv_sec, tv_set.tv_nsec);
+ printf("set time to %" PRId64 ".%.9" PRId64 "\n", (int64_t)tv_set.tv_sec, (int64_t)tv_set.tv_nsec);
}
#else
/* Traditional Linux way to set the system clock
@@ -196,7 +197,7 @@ static void set_time(struct ntptime *new
exit(1);
}
if (debug) {
- printf("set time to %lu.%.6lu\n", tv_set.tv_sec, tv_set.tv_usec);
+ printf("set time to %" PRId64 ".%.6" PRId64 "\n", (int64_t)tv_set.tv_sec, (int64_t)tv_set.tv_usec);
}
#endif
}