author | Markus Bröker <mbroeker@largo.dyndns.tv> |
Tue, 09 Jun 2009 12:42:30 +0200 | |
changeset 98 | 0e8eddac99cb |
parent 77 | 49e0babccb23 |
child 131 | b5ad49852adc |
permissions | -rw-r--r-- |
9
c3fecc82ade6
standard tags for git projects
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
1 |
/** |
77 | 2 |
* counter.c |
9
c3fecc82ade6
standard tags for git projects
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
3 |
* Copyright (C) 2008 Markus Broeker |
0 | 4 |
*/ |
5 |
||
6 |
#include <stdio.h> |
|
7 |
#include <stdlib.h> |
|
8 |
#include <time.h> |
|
9 |
||
10 |
int main (int argc, char **argv) |
|
11 |
{ |
|
12 |
time_t t; |
|
27
81a574d60c15
typo in min2time format string
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
9
diff
changeset
|
13 |
|
0 | 14 |
struct tm *time_str; |
27
81a574d60c15
typo in min2time format string
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
9
diff
changeset
|
15 |
|
0 | 16 |
int start, end; |
17 |
||
18 |
if (argc != 2) { |
|
19 |
printf ("Usage: %s \"<command>\"\n", argv[0]); |
|
20 |
return EXIT_FAILURE; |
|
21 |
} |
|
22 |
||
23 |
time (&t); |
|
24 |
time_str = gmtime (&t); |
|
25 |
||
26 |
start = time_str->tm_hour * 60 * 60 + time_str->tm_min * 60 + time_str->tm_sec; |
|
27 |
||
28 |
system (argv[1]); |
|
29 |
||
30 |
time (&t); |
|
31 |
time_str = gmtime (&t); |
|
32 |
||
33 |
end = time_str->tm_hour * 60 * 60 + time_str->tm_min * 60 + time_str->tm_sec; |
|
34 |
||
35 |
printf ("Command Execution Time: %8ds\n", end - start); |
|
36 |
||
37 |
return EXIT_SUCCESS; |
|
38 |
} |