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

  1. --- a/adjtimex.c
  2. +++ b/adjtimex.c
  3. @@ -36,6 +36,7 @@
  4. * gcc -Wall -O adjtimex_1.c -o adjtimex
  5. */
  6. +#include <inttypes.h>
  7. #include <stdio.h>
  8. #include <sys/types.h>
  9. #include <stdlib.h>
  10. @@ -143,12 +144,12 @@ int main(int argc, char ** argv)
  11. " precision: %ld\n"
  12. " tolerance: %ld\n"
  13. "-t tick: %ld\n"
  14. - " time.tv_sec: %ld\n"
  15. - " time.tv_usec: %ld\n"
  16. + " time.tv_sec: %" PRId64 "\n"
  17. + " time.tv_usec: %" PRId64 "\n"
  18. " return value: %d (%s)\n",
  19. txc.constant,
  20. txc.precision, txc.tolerance, txc.tick,
  21. - txc.time.tv_sec, txc.time.tv_usec, ret,
  22. + (int64_t)txc.time.tv_sec, (int64_t)txc.time.tv_usec, ret,
  23. (ret >= 0 && ret <= 5) ? ret_code_descript[ret] : "error" );
  24. }
  25. return (ret<0);
  26. --- a/ntpclient.c
  27. +++ b/ntpclient.c
  28. @@ -29,6 +29,7 @@
  29. * labelled "XXX fixme - non-automatic build configuration".
  30. */
  31. +#include <inttypes.h>
  32. #include <stdio.h>
  33. #include <stdlib.h>
  34. #include <string.h>
  35. @@ -181,7 +182,7 @@ static void set_time(struct ntptime *new)
  36. exit(1);
  37. }
  38. if (debug) {
  39. - printf("set time to %lu.%.9lu\n", tv_set.tv_sec, tv_set.tv_nsec);
  40. + printf("set time to %" PRId64 ".%.9" PRId64 "\n", (int64_t)tv_set.tv_sec, (int64_t)tv_set.tv_nsec);
  41. }
  42. #else
  43. /* Traditional Linux way to set the system clock
  44. @@ -196,7 +197,7 @@ static void set_time(struct ntptime *new)
  45. exit(1);
  46. }
  47. if (debug) {
  48. - printf("set time to %lu.%.6lu\n", tv_set.tv_sec, tv_set.tv_usec);
  49. + printf("set time to %" PRId64 ".%.6" PRId64 "\n", (int64_t)tv_set.tv_sec, (int64_t)tv_set.tv_usec);
  50. }
  51. #endif
  52. }