time: errno is not guaranteed to be set for sysconf()
0 should be considered an invalid CLK_TCK.
This commit is contained in:
parent
65ae4afa7c
commit
d083a94731
6
time.c
6
time.c
|
@ -25,8 +25,6 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
ARGBEGIN {
|
ARGBEGIN {
|
||||||
case 'p':
|
case 'p':
|
||||||
/* used to specify POSIX output format, but that's the only format we
|
|
||||||
* have for now */
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
|
@ -35,8 +33,8 @@ main(int argc, char *argv[])
|
||||||
if (!*argv)
|
if (!*argv)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
if ((ticks = sysconf(_SC_CLK_TCK)) < 0)
|
if ((ticks = sysconf(_SC_CLK_TCK)) <= 0)
|
||||||
eprintf("sysconf() failed to retrieve clock ticks per second:");
|
eprintf("sysconf() failed to retrieve clock ticks per second\n");
|
||||||
|
|
||||||
if ((rbeg = times(&tms)) < 0)
|
if ((rbeg = times(&tms)) < 0)
|
||||||
eprintf("times() failed to retrieve start times:");
|
eprintf("times() failed to retrieve start times:");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user