| 1 | /** |
| 2 | * This file has no copyright assigned and is placed in the Public Domain. |
| 3 | * This file is part of the mingw-w64 runtime package. |
| 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package. |
| 5 | */ |
| 6 | #ifndef _TIMEB_H_ |
| 7 | #define _TIMEB_H_ |
| 8 | |
| 9 | #include <crtdefs.h> |
| 10 | |
| 11 | #ifndef _WIN32 |
| 12 | #error Only Win32 target is supported! |
| 13 | #endif |
| 14 | |
| 15 | #pragma pack(push,_CRT_PACKING) |
| 16 | |
| 17 | #ifdef __cplusplus |
| 18 | extern "C" { |
| 19 | #endif |
| 20 | |
| 21 | #ifndef _CRTIMP |
| 22 | #define _CRTIMP __declspec(dllimport) |
| 23 | #endif |
| 24 | |
| 25 | #ifdef _USE_32BIT_TIME_T |
| 26 | #ifdef _WIN64 |
| 27 | #undef _USE_32BIT_TIME_T |
| 28 | #endif |
| 29 | #endif |
| 30 | |
| 31 | #ifndef _TIME32_T_DEFINED |
| 32 | typedef long __time32_t; |
| 33 | #define _TIME32_T_DEFINED |
| 34 | #endif |
| 35 | |
| 36 | #ifndef _TIME64_T_DEFINED |
| 37 | __MINGW_EXTENSION typedef __int64 __time64_t; |
| 38 | #define _TIME64_T_DEFINED |
| 39 | #endif |
| 40 | |
| 41 | #ifndef _TIME_T_DEFINED |
| 42 | #ifdef _USE_32BIT_TIME_T |
| 43 | typedef __time32_t time_t; |
| 44 | #else |
| 45 | typedef __time64_t time_t; |
| 46 | #endif |
| 47 | #define _TIME_T_DEFINED |
| 48 | #endif |
| 49 | |
| 50 | #ifndef _TIMEB_DEFINED |
| 51 | #define _TIMEB_DEFINED |
| 52 | |
| 53 | struct __timeb32 { |
| 54 | __time32_t time; |
| 55 | unsigned short millitm; |
| 56 | short timezone; |
| 57 | short dstflag; |
| 58 | }; |
| 59 | |
| 60 | #ifndef	NO_OLDNAMES |
| 61 | struct timeb { |
| 62 | time_t time; |
| 63 | unsigned short millitm; |
| 64 | short timezone; |
| 65 | short dstflag; |
| 66 | }; |
| 67 | #endif |
| 68 | |
| 69 | struct __timeb64 { |
| 70 | __time64_t time; |
| 71 | unsigned short millitm; |
| 72 | short timezone; |
| 73 | short dstflag; |
| 74 | }; |
| 75 | |
| 76 | #endif |
| 77 | |
| 78 | _CRTIMP void __cdecl _ftime64(struct __timeb64 *_Time); |
| 79 | _CRTIMP void __cdecl _ftime32(struct __timeb32 *_Time); |
| 80 | |
| 81 | /* |
| 82 | * To prevent ABI issues, the mingw-w64 runtime should not call the |
| 83 | * _timeb and _ftime functions. Instead it should call the fixed-size variants. |
| 84 | */ |
| 85 | #ifndef _CRTBLD |
| 86 | #ifndef _USE_32BIT_TIME_T |
| 87 | #define _timeb __timeb64 |
| 88 | #define _ftime _ftime64 |
| 89 | #else |
| 90 | #define _timeb __timeb32 |
| 91 | #define _ftime _ftime32 |
| 92 | #endif |
| 93 | #endif /* _CRTBLD */ |
| 94 | |
| 95 | struct _timespec32 { |
| 96 | __time32_t tv_sec; |
| 97 | long tv_nsec; |
| 98 | }; |
| 99 | |
| 100 | struct _timespec64 { |
| 101 | __time64_t tv_sec; |
| 102 | long tv_nsec; |
| 103 | }; |
| 104 | |
| 105 | #ifndef _TIMESPEC_DEFINED |
| 106 | #define _TIMESPEC_DEFINED |
| 107 | struct timespec { |
| 108 | time_t tv_sec; /* Seconds */ |
| 109 | long tv_nsec; /* Nanoseconds */ |
| 110 | }; |
| 111 | |
| 112 | struct itimerspec { |
| 113 | struct timespec it_interval; /* Timer period */ |
| 114 | struct timespec it_value; /* Timer expiration */ |
| 115 | }; |
| 116 | #endif |
| 117 | |
| 118 | /* |
| 119 | * To prevent ABI issues, the mingw-w64 runtime should not call the |
| 120 | * ftime function. Instead it should call the fixed-size variants. |
| 121 | */ |
| 122 | #ifndef _CRTBLD |
| 123 | #if !defined (RC_INVOKED) && !defined (NO_OLDNAMES) |
| 124 | #ifndef _USE_32BIT_TIME_T |
| 125 | int __cdecl ftime (struct timeb *) __MINGW_ASM_CALL(ftime64); |
| 126 | #else |
| 127 | int __cdecl ftime (struct timeb *) __MINGW_ASM_CALL(ftime32); |
| 128 | #endif /* _USE_32BIT_TIME_T */ |
| 129 | #endif |
| 130 | #endif /* _CRTBLD */ |
| 131 | |
| 132 | #ifdef __cplusplus |
| 133 | } |
| 134 | #endif |
| 135 | |
| 136 | #pragma pack(pop) |
| 137 | |
| 138 | #include <sec_api/sys/timeb_s.h> |
| 139 | #endif |