author | Markus Bröker <mbroeker@largo.dyndns.tv> |
Thu, 16 Apr 2009 12:50:39 +0200 | |
changeset 75 | a2c32869d4d5 |
parent 27 | 81a574d60c15 |
child 77 | 49e0babccb23 |
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; |
|
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 |
} |