OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

sys_time.h
1 /*
2 This is part of the OTF library. Copyright by ZIH, TU Dresden 2005-2012.
3 Authors: Andreas Knuepfer, Holger Brunst, Ronny Brendel, Thomas Kriebitzsch
4 */
5
6 #ifndef CUSTOM_SYS_TIME_H
7 #define CUSTOM_SYS_TIME_H
8
9
10 #ifdef WIN32
11
12 #include "OTF_Platform.h"
13
14 /* Based on timeval.h by Wu Yongwei */
15
16
17 #ifdef __cplusplus
18 extern "C" {
19 #endif /* __cplusplus */
20
21
22 #define EPOCHFILETIME (116444736000000000LL)
23
24
25 #include <time.h>
26 #include <windows.h>
27
28
29 typedef struct {
30 long tv_sec;
31 long tv_usec;
32 } timeval;
33
34 struct timezone {
35 int tz_minuteswest; /* minutes W of Greenwich */
36 int tz_dsttime; /* type of dst correction */
37 };
38
39
40 static int gettimeofday(struct timeval *tv, struct timezone *tz)
41 {
42 FILETIME ft;
43 LARGE_INTEGER li;
44 __int64 t;
45 static int tzflag;
46
47 if (tv) {
48 GetSystemTimeAsFileTime(&ft);
49 li.LowPart = ft.dwLowDateTime;
50 li.HighPart = ft.dwHighDateTime;
51 t = li.QuadPart; /* In 100-nanosecond intervals */
52 t -= EPOCHFILETIME; /* Offset to the Epoch time */
53 t /= 10; /* In microseconds */
54 tv->tv_sec = (long)(t / 1000000);
55 tv->tv_usec = (long)(t % 1000000);
56 }
57
58 if (tz) {
59 if (!tzflag) {
60 _tzset();
61 tzflag++;
62 }
63 tz->tz_minuteswest = _timezone / 60;
64 tz->tz_dsttime = _daylight;
65 }
66
67 return 0;
68 }
69
70
71 #ifdef __cplusplus
72 }
73 #endif /* __cplusplus */
74
75 #endif /* WIN32 */
76
77
78 #endif /* CUSTOM_SYS_TIME_H */
OTF_Platform.h
Deals with platform dependend issues.
timezone
Definition: ompi_time.h:172