diff --git a/libnpfs/conn.c b/libnpfs/conn.c index e095dc51..76177b7d 100644 --- a/libnpfs/conn.c +++ b/libnpfs/conn.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -132,8 +133,8 @@ _debug_trace (Npsrv *srv, Npfcall *fc) (void)gettimeofday(&b, NULL); (void)gettimeofday(&a, NULL); timersub(&a, &b, &c); - np_logmsg(srv, "[%lu.%-3lu] %s", - c.tv_sec, c.tv_usec/1000, s); + np_logmsg(srv, "[%"PRIdMAX".%-3"PRIdMAX"] %s", + (intmax_t)c.tv_sec, (intmax_t)c.tv_usec/1000, s); } else np_logmsg(srv, "%s", s); } diff --git a/libnpfs/ctl.c b/libnpfs/ctl.c index f40cde47..317a22e3 100644 --- a/libnpfs/ctl.c +++ b/libnpfs/ctl.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -291,9 +292,9 @@ _ctl_get_date (char *name, void *a) np_uerror (errno); goto error; } - if (aspf (&s, &len, "%lu.%lu %d.%d\n", - tv.tv_sec, tv.tv_usec, - tz.tz_minuteswest, tz.tz_dsttime) < 0) { + if (aspf (&s, &len, "%"PRIdMAX".%"PRIdMAX" %d.%d\n", + (uintmax_t)tv.tv_sec, (uintmax_t)tv.tv_usec, + tz.tz_minuteswest, tz.tz_dsttime) < 0) { np_uerror (ENOMEM); goto error; } diff --git a/utils/dioddate.c b/utils/dioddate.c index bde002ff..f392792b 100644 --- a/utils/dioddate.c +++ b/utils/dioddate.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #if HAVE_GETOPT_H @@ -142,11 +143,16 @@ main (int argc, char *argv[]) errn (np_rerror (), "error reading date"); goto done; } - if (sscanf (buf, "%lu.%lu %d.%d", &tv.tv_sec, &tv.tv_usec, + + int64_t sec = 0, usec = 0; + if (sscanf (buf, "%"SCNd64".%"SCNd64" %d.%d", &sec, &usec, &tz.tz_minuteswest, &tz.tz_dsttime) != 4) { msg ("error scanning returned date: %s", buf); goto done; } + tv.tv_sec = sec; + tv.tv_usec = usec; + if (Sopt) { if (settimeofday (&tv, &tz) < 0) err_exit ("settimeofday");