Subversion Repositories HelenOS

Rev

Rev 2714 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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