Module Name: othersrc
Committed By: simonb
Date: Thu Feb 25 10:18:38 UTC 2021
Modified Files:
othersrc/usr.bin/sleepto: sleepto.c
Log Message:
Use %lld and cast to "long long" for any time_t's.
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 othersrc/usr.bin/sleepto/sleepto.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: othersrc/usr.bin/sleepto/sleepto.c
diff -u othersrc/usr.bin/sleepto/sleepto.c:1.2 othersrc/usr.bin/sleepto/sleepto.c:1.3
--- othersrc/usr.bin/sleepto/sleepto.c:1.2 Thu Feb 25 08:42:31 2021
+++ othersrc/usr.bin/sleepto/sleepto.c Thu Feb 25 10:18:38 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: sleepto.c,v 1.2 2021/02/25 08:42:31 simonb Exp $ */
+/* $NetBSD: sleepto.c,v 1.3 2021/02/25 10:18:38 simonb Exp $ */
#include <err.h>
#include <signal.h>
@@ -42,7 +42,7 @@ main(int argc, char *argv[])
when = parsetime(argc, argv);
now = tv.tv_sec;
- printf("sleeping for %ld seconds...\n", when - now);
+ printf("sleeping for %lld seconds...\n", (long long)when - now);
ntime.tv_sec = when - now;
if (ntime.tv_sec <= 0)
return EXIT_SUCCESS;
@@ -53,10 +53,10 @@ main(int argc, char *argv[])
while ((rv = nanosleep(&ntime, &ntime)) != 0) {
if (report_requested) {
/* Reporting does not bother with nanoseconds. */
- warnx("about %ld second%s left out of the original %ld",
- ntime.tv_sec,
+ warnx("about %lld second%s left out of the original %lld",
+ (long long)ntime.tv_sec,
ntime.tv_sec == 1 ? "" : "s",
- original);
+ (long long)original);
report_requested = 0;
} else
break;