author | Markus Bröker <mbroeker@largo.dyndns.tv> |
Sat, 13 Dec 2008 17:58:17 +0100 | |
changeset 25 | 6cf883f9c506 |
parent 9 | c3fecc82ade6 |
child 27 | 81a574d60c15 |
permissions | -rw-r--r-- |
9
c3fecc82ade6
standard tags for git projects
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
1 |
/** |
c3fecc82ade6
standard tags for git projects
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
2 |
* test/demos/counter.c |
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; |
|
13 |
struct tm *time_str; |
|
14 |
int start, end; |
|
15 |
||
16 |
if (argc != 2) { |
|
17 |
printf ("Usage: %s \"<command>\"\n", argv[0]); |
|
18 |
return EXIT_FAILURE; |
|
19 |
} |
|
20 |
||
21 |
time (&t); |
|
22 |
time_str = gmtime (&t); |
|
23 |
||
24 |
start = time_str->tm_hour * 60 * 60 + time_str->tm_min * 60 + time_str->tm_sec; |
|
25 |
||
26 |
system (argv[1]); |
|
27 |
||
28 |
time (&t); |
|
29 |
time_str = gmtime (&t); |
|
30 |
||
31 |
end = time_str->tm_hour * 60 * 60 + time_str->tm_min * 60 + time_str->tm_sec; |
|
32 |
||
33 |
printf ("Command Execution Time: %8ds\n", end - start); |
|
34 |
||
35 |
return EXIT_SUCCESS; |
|
36 |
} |