about summary refs log tree commit diff
path: root/Src/builtin.c
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2014-05-29 21:40:33 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2014-05-29 21:40:33 +0100
commit880020ca2ed8207fe39aa95169a6f9226ff7b8dc (patch)
tree79483423b8e155062c311cbf7ce057be5b1905e5 /Src/builtin.c
parent5554cf8244aaa4e7bf5f153e66cd5db64e50c6e4 (diff)
downloadzsh-880020ca2ed8207fe39aa95169a6f9226ff7b8dc.tar.gz
zsh-880020ca2ed8207fe39aa95169a6f9226ff7b8dc.tar.xz
zsh-880020ca2ed8207fe39aa95169a6f9226ff7b8dc.zip
32624: use correct scaling factor (clock ticks) for times
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 0cc54b7bb..42354b928 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -6095,8 +6095,9 @@ bin_test(char *name, char **argv, UNUSED(Options ops), int func)
 }
 
 /* display a time, provided in units of 1/60s, as minutes and seconds */
-#define pttime(X) printf("%ldm%ld.%02lds",((long) (X))/3600,\
-			 ((long) (X))/60%60,((long) (X))*100/60%100)
+#define pttime(X) printf("%ldm%ld.%02lds",((long) (X))/(60 * clktck),\
+			 ((long) (X))/clktck%clktck,\
+			 ((long) (X))*100/clktck%100)
 
 /* times: display, in a two-line format, the times provided by times(3) */
 
@@ -6105,6 +6106,7 @@ int
 bin_times(UNUSED(char *name), UNUSED(char **argv), UNUSED(Options ops), UNUSED(int func))
 {
     struct tms buf;
+    long clktck = get_clktck();
 
     /* get time accounting information */
     if (times(&buf) == -1)