Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 1, or (at your option) any later
+Software Foundation; either version 2, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
-Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
$PRODUCES times.c
#include "../bashtypes.h"
#include "../shell.h"
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if defined (HAVE_SYS_TIME_H)
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
-#endif
+#include <posixtime.h>
#if defined (HAVE_SYS_TIMES_H)
# include <sys/times.h>
#else
# if defined (HAVE_TIMES)
- /* As of System V.3, HP-UX 6.5, and other ATT-like systems, this stuff is
- returned in terms of clock ticks (HZ from sys/param.h). C'mon, guys.
- This kind of stupid clock-dependent stuff is exactly the reason 4.2BSD
- introduced the `timeval' struct. */
+ /* This uses the POSIX.1/XPG5 times(2) interface, which fills in a
+ `struct tms' with values of type clock_t. */
struct tms t;
times (&t);
- print_time_in_hz (stdout, t.tms_utime);
+ print_clock_t (stdout, t.tms_utime);
putchar (' ');
- print_time_in_hz (stdout, t.tms_stime);
+ print_clock_t (stdout, t.tms_stime);
putchar ('\n');
- print_time_in_hz (stdout, t.tms_cutime);
+ print_clock_t (stdout, t.tms_cutime);
putchar (' ');
- print_time_in_hz (stdout, t.tms_cstime);
+ print_clock_t (stdout, t.tms_cstime);
putchar ('\n');
# else /* !HAVE_TIMES */
printf ("0.00 0.00\n0.00 0.00\n");