Line | |
---|
1 | #include "madx.h" |
---|
2 | #include <time.h> |
---|
3 | |
---|
4 | #ifndef _WIN32 |
---|
5 | #include <sys/time.h> /* for gettimeofday */ |
---|
6 | #else |
---|
7 | #include <sys/timeb.h> /* for ftime */ |
---|
8 | #endif |
---|
9 | |
---|
10 | void |
---|
11 | time_stamp(char* place) |
---|
12 | { |
---|
13 | time_t now; |
---|
14 | int k, l; |
---|
15 | |
---|
16 | (void)place; |
---|
17 | time(&now); /* get system time */ |
---|
18 | k = (int)now - (int)start_time; |
---|
19 | l = (int)now - (int)last_time; |
---|
20 | last_time = now; |
---|
21 | fprintf(prt_file, "sec.s since start: %d since last call: %d\n", k, l); |
---|
22 | } |
---|
23 | |
---|
24 | #if 0 // not used... (commented in micado) |
---|
25 | static float |
---|
26 | fextim(void) |
---|
27 | { |
---|
28 | float mytime; |
---|
29 | |
---|
30 | #ifndef _WIN32 /* gettimeofday available */ |
---|
31 | struct timeval tp; |
---|
32 | gettimeofday(&tp,0); |
---|
33 | mytime = (float)(tp.tv_sec%10000) + 1.e-6 * tp.tv_usec; /* seconds from epoch, modulo 10 000 */ |
---|
34 | #else /* use old ftime */ |
---|
35 | struct timeb tp; |
---|
36 | ftime(&tp); |
---|
37 | mytime = (float)(tp.time%10000) + 0.001*tp.millitm; |
---|
38 | #endif |
---|
39 | |
---|
40 | /* printf("Time now: %-6.3f\n",mytime); */ |
---|
41 | return mytime; |
---|
42 | } |
---|
43 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.