From bc8aff4484888b90f6974941229ac308ea0fd8f1 Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Sun, 13 Jul 2003 20:06:41 +0000 Subject: [PATCH] If mktime() or timegm() return -1, print out the resume timer value as "unknown", rather than a conversion of -1 to a date/timestamp. --- usr.sbin/apm/apm.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/usr.sbin/apm/apm.c b/usr.sbin/apm/apm.c index b0afefb56dfe..62a3aedf01fc 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"); } }