Rev 2714 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2714 | cejka | 1 | #ifdef _GNU_SOURCE |
2 | /* |
||
3 | * Copyright (c) 1999 Herbert Xu <herbert@debian.org> |
||
4 | * This file contains code for the times builtin. |
||
5 | * $Id: ash-0.4.0-cumulative_fixes-1.patch,v 1.1 2004/06/04 10:32:01 jim Exp $ |
||
6 | */ |
||
7 | |||
8 | #include <stdio.h> |
||
9 | #include <sys/times.h> |
||
10 | #include <unistd.h> |
||
11 | |||
12 | #define main timescmd |
||
13 | |||
14 | int main() { |
||
15 | struct tms buf; |
||
16 | long int clk_tck = sysconf(_SC_CLK_TCK); |
||
17 | |||
18 | times(&buf); |
||
19 | printf("%dm%fs %dm%fs\n%dm%fs %dm%fs\n", |
||
20 | (int) (buf.tms_utime / clk_tck / 60), |
||
21 | ((double) buf.tms_utime) / clk_tck, |
||
22 | (int) (buf.tms_stime / clk_tck / 60), |
||
23 | ((double) buf.tms_stime) / clk_tck, |
||
24 | (int) (buf.tms_cutime / clk_tck / 60), |
||
25 | ((double) buf.tms_cutime) / clk_tck, |
||
26 | (int) (buf.tms_cstime / clk_tck / 60), |
||
27 | ((double) buf.tms_cstime) / clk_tck); |
||
28 | return 0; |
||
29 | } |
||
30 | #endif /* _GNU_SOURCE */ |