]>
Commit | Line | Data |
---|---|---|
1 | diff -urN netbsd-sh/bltin/times.c ash-0.3.7.orig/bltin/times.c | |
2 | --- netbsd-sh/bltin/times.c Thu Jan 1 01:00:00 1970 | |
3 | +++ ash-0.3.7.orig/bltin/times.c Mon Apr 23 22:16:46 2001 | |
4 | @@ -0,0 +1,30 @@ | |
5 | +#ifdef _GNU_SOURCE | |
6 | +/* | |
7 | + * Copyright (c) 1999 Herbert Xu <herbert@debian.org> | |
8 | + * This file contains code for the times builtin. | |
9 | + * $Id$ | |
10 | + */ | |
11 | + | |
12 | +#include <stdio.h> | |
13 | +#include <sys/times.h> | |
14 | +#include <unistd.h> | |
15 | + | |
16 | +#define main timescmd | |
17 | + | |
18 | +int main() { | |
19 | + struct tms buf; | |
20 | + long int clk_tck = sysconf(_SC_CLK_TCK); | |
21 | + | |
22 | + times(&buf); | |
23 | + printf("%dm%fs %dm%fs\n%dm%fs %dm%fs\n", | |
24 | + (int) (buf.tms_utime / clk_tck / 60), | |
25 | + ((double) buf.tms_utime) / clk_tck, | |
26 | + (int) (buf.tms_stime / clk_tck / 60), | |
27 | + ((double) buf.tms_stime) / clk_tck, | |
28 | + (int) (buf.tms_cutime / clk_tck / 60), | |
29 | + ((double) buf.tms_cutime) / clk_tck, | |
30 | + (int) (buf.tms_cstime / clk_tck / 60), | |
31 | + ((double) buf.tms_cstime) / clk_tck); | |
32 | + return 0; | |
33 | +} | |
34 | +#endif /* _GNU_SOURCE */ | |
35 | diff -urN netbsd-sh/builtins.def ash-0.3.7.orig/builtins.def | |
36 | --- netbsd-sh/builtins.def Mon Apr 10 13:02:58 2000 | |
37 | +++ ash-0.3.7.orig/builtins.def Mon Apr 23 22:16:46 2001 | |
38 | @@ -91,3 +93,4 @@ | |
39 | aliascmd alias | |
40 | ulimitcmd ulimit | |
41 | testcmd test [ | |
42 | +timescmd times |