If mktime() or timegm() return -1, print out the resume timer value as

"unknown", rather than a conversion of -1 to a date/timestamp.
This commit is contained in:
Robert Watson 2003-07-13 20:06:41 +00:00
parent 45cabbdc58
commit bc8aff4484
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=117517

View File

@ -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");
}
}