Home | History | Annotate | Download | only in sys
      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 
     80 #ifdef _WIN64
     81 #define _timeb __timeb64
     82   _CRTIMP void __cdecl _ftime(struct __timeb64 *);
     83 #else
     84 #define _timeb __timeb32
     85   _CRTIMP void __cdecl _ftime(struct __timeb32 *);
     86 #endif
     87 
     88 #ifndef _TIMESPEC_DEFINED
     89 #define _TIMESPEC_DEFINED
     90 struct timespec {
     91   time_t  tv_sec;   /* Seconds */
     92   long    tv_nsec;  /* Nanoseconds */
     93 };
     94 
     95 struct itimerspec {
     96   struct timespec  it_interval;  /* Timer period */
     97   struct timespec  it_value;     /* Timer expiration */
     98 };
     99 #endif
    100 
    101 #if !defined (RC_INVOKED) && !defined (NO_OLDNAMES)
    102   void __cdecl ftime (struct timeb *);
    103 
    104 #ifndef __CRT__NO_INLINE
    105   /* TODO: Avoid structure cast here !!!! */
    106 #ifndef _USE_32BIT_TIME_T
    107   __CRT_INLINE void __cdecl ftime(struct timeb *_Tmb) {
    108     _ftime64((struct __timeb64 *)_Tmb);
    109   }
    110 #else
    111   __CRT_INLINE void __cdecl ftime(struct timeb *_Tmb) {
    112     _ftime((struct __timeb32 *)_Tmb);
    113   }
    114 #endif /* _USE_32BIT_TIME_T */
    115 #endif /* !__CRT__NO_INLINE */
    116 #endif
    117 
    118 #ifdef __cplusplus
    119 }
    120 #endif
    121 
    122 #pragma pack(pop)
    123 
    124 #include <sec_api/sys/timeb_s.h>
    125 #endif
    126