]> git.ipfire.org Git - thirdparty/bash.git/blobdiff - builtins/times.def
Imported from ../bash-2.04.tar.gz.
[thirdparty/bash.git] / builtins / times.def
index 630642c5691d9afb89f216cf5a12afa151da6948..4dba72489652be0708c6dc9d0678ca9ea4fea10f 100644 (file)
@@ -7,7 +7,7 @@ This file is part of GNU Bash, the Bourne Again SHell.
 
 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
@@ -17,7 +17,7 @@ for more details.
 
 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
 
@@ -41,16 +41,7 @@ $END
 #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>
@@ -84,21 +75,19 @@ times_builtin (list)
 
 #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");