summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2003-07-13 20:06:41 +0000
committerrwatson <rwatson@FreeBSD.org>2003-07-13 20:06:41 +0000
commit06d9cc33dc7e14d9c3938def6407d36dc327d8d3 (patch)
tree28179b705c64704dfe6b8f977061820c6c9a0666
parenta680f2e3d9449786c1bdb3a113c36eeddab83df9 (diff)
downloadFreeBSD-src-06d9cc33dc7e14d9c3938def6407d36dc327d8d3.zip
FreeBSD-src-06d9cc33dc7e14d9c3938def6407d36dc327d8d3.tar.gz
If mktime() or timegm() return -1, print out the resume timer value as
"unknown", rather than a conversion of -1 to a date/timestamp.
-rw-r--r--usr.sbin/apm/apm.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/apm/apm.c b/usr.sbin/apm/apm.c
index b0afefb..62a3aed 100644
--- a/usr.sbin/apm/apm.c
+++ b/usr.sbin/apm/apm.c
@@ -293,9 +293,12 @@ print_all_info(int fd, apm_info_t aip, int bioscall_available)
t = mktime(&tm);
else
t = timegm(&tm);
- tm = *localtime(&t);
- strftime(buf, sizeof(buf), "%c", &tm);
- printf("Resume timer: %s\n", buf);
+ if (t != -1) {
+ tm = *localtime(&t);
+ strftime(buf, sizeof(buf), "%c", &tm);
+ printf("Resume timer: %s\n", buf);
+ } else
+ printf("Resume timer: unknown\n");
}
}
OpenPOWER on IntegriCloud