Debian Codegraph @

common/win/wintime.h

raw
1 #ifndef INC_SRT_WIN_WINTIME
2 #define INC_SRT_WIN_WINTIME
3
4 #include <winsock2.h>
5 #include <windows.h>
6 // HACK: This include is a workaround for a bug in the MinGW headers
7 // where pthread.h, which defines _POSIX_THREAD_SAFE_FUNCTIONS,
8 // has to be included before time.h so that time.h defines
9 // localtime_r correctly
10 #include <time.h>
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16 #if !defined(_MSC_VER)
17 #define SRTCOMPAT_WINTIME_STATIC_INLINE_DECL static inline
18 #else
19 // NOTE: MVC Does not like static inline for C functions in some versions.
20 // so just use static for MVC.
21 #define SRTCOMPAT_WINTIME_STATIC_INLINE_DECL static
22 #endif
23
24 #ifndef _TIMEZONE_DEFINED /* also in sys/time.h */
25 #define _TIMEZONE_DEFINED
26 struct timezone
27 {
28 int tz_minuteswest; /* minutes W of Greenwich */
29 int tz_dsttime; /* type of dst correction */
30 };
31 #endif
32
33 void SRTCompat_timeradd(
34 struct timeval *a, struct timeval *b, struct timeval *result);
35 SRTCOMPAT_WINTIME_STATIC_INLINE_DECL void timeradd(
36 struct timeval *a, struct timeval *b, struct timeval *result)
37 {
38 SRTCompat_timeradd(a, b, result);
39 }
40
41 int SRTCompat_gettimeofday(
42 struct timeval* tp, struct timezone* tz);
43 SRTCOMPAT_WINTIME_STATIC_INLINE_DECL int gettimeofday(
44 struct timeval* tp, struct timezone* tz)
45 {
46 return SRTCompat_gettimeofday(tp, tz);
47 }
48
49 #undef SRTCOMPAT_WINTIME_STATIC_INLINE_DECL
50
51 #ifdef __cplusplus
52 }
53 #endif
54
55 #endif // INC_SRT_WIN_WINTIME