ReactOS  0.4.14-dev-606-g14ebc0b
time.h File Reference
#include <crtdefs.h>
Include dependency graph for time.h:

Go to the source code of this file.

Classes

struct  tm
 

Macros

#define _CLOCK_T_DEFINED
 
#define NULL   ((void *)0)
 
#define _TM_DEFINED
 
#define CLOCKS_PER_SEC   1000
 
#define _WTIME_DEFINED
 
#define _INC_WTIME_INL
 
#define CLK_TCK   CLOCKS_PER_SEC
 

Typedefs

typedef long clock_t
 

Functions

 _CRTDATA (extern int _daylight)
 
 _CRTDATA (extern long _dstbias)
 
 _CRTDATA (extern char *_tzname[2])
 
_CRTIMP errno_t __cdecl _get_daylight (_Out_ int *_Daylight)
 
_CRTIMP errno_t __cdecl _get_dstbias (_Out_ long *_Daylight_savings_bias)
 
_CRTIMP errno_t __cdecl _get_timezone (_Out_ long *_Timezone)
 
_CRTIMP errno_t __cdecl _get_tzname (_Out_ size_t *_ReturnValue, _Out_writes_z_(_SizeInBytes) char *_Buffer, _In_ size_t _SizeInBytes, _In_ int _Index)
 
_Check_return_ _CRTIMP char *__cdecl asctime (_In_ const struct tm *_Tm)
 
_CRTIMP char *__cdecl _ctime32 (_In_ const __time32_t *_Time)
 
_Check_return_ _CRTIMP clock_t __cdecl clock (void)
 
_CRTIMP double __cdecl _difftime32 (_In_ __time32_t _Time1, _In_ __time32_t _Time2)
 
_Check_return_ _CRTIMP struct tm *__cdecl _gmtime32 (_In_ const __time32_t *_Time)
 
_CRTIMP struct tm *__cdecl _localtime32 (_In_ const __time32_t *_Time)
 
 _Success_ (return > 0) _CRTIMP size_t __cdecl strftime(_Out_writes_z_(_SizeInBytes) char *_Buf
 
_CRTIMP char *__cdecl _strdate (_Out_writes_z_(9) char *_Buffer)
 
_CRTIMP char *__cdecl _strtime (_Out_writes_z_(9) char *_Buffer)
 
_CRTIMP __time32_t __cdecl _time32 (_Out_opt_ __time32_t *_Time)
 
_CRTIMP __time32_t __cdecl _mktime32 (_Inout_ struct tm *_Tm)
 
_CRTIMP __time32_t __cdecl _mkgmtime32 (_Inout_ struct tm *_Tm)
 
_CRTIMP void __cdecl _tzset (void)
 
 _CRT_OBSOLETE (GetLocalTime) unsigned __cdecl _getsystime(_Out_ struct tm *_Tm)
 
unsigned __cdecl _setsystime (_In_ struct tm *_Tm, unsigned _MilliSec)
 
_Check_return_wat_ _CRTIMP errno_t __cdecl asctime_s (_Out_writes_(_SizeInBytes) _Post_readable_size_(26) char *_Buf, _In_range_(>=, 26) size_t _SizeInBytes, _In_ const struct tm *_Tm)
 
 _Success_ (return==0) _CRTIMP errno_t __cdecl _ctime32_s(_Out_writes_(_SizeInBytes) _Post_readable_size_(26) char *_Buf
 
_Check_return_wat_ _CRTIMP errno_t __cdecl _gmtime32_s (_In_ struct tm *_Tm, _In_ const __time32_t *_Time)
 
_CRTIMP errno_t __cdecl _localtime32_s (_Out_ struct tm *_Tm, _In_ const __time32_t *_Time)
 
_Check_return_wat_ _CRTIMP errno_t __cdecl _strdate_s (_Out_writes_(_SizeInBytes) _Post_readable_size_(9) char *_Buf, _In_range_(>=, 9) size_t _SizeInBytes)
 
_Check_return_wat_ _CRTIMP errno_t __cdecl _strtime_s (_Out_writes_(_SizeInBytes) _Post_readable_size_(9) char *_Buf, _In_range_(>=, 9) size_t _SizeInBytes)
 
_Check_return_ _CRTIMP double __cdecl _difftime64 (_In_ __time64_t _Time1, _In_ __time64_t _Time2)
 
_CRTIMP char *__cdecl _ctime64 (_In_ const __time64_t *_Time)
 
_CRTIMP struct tm *__cdecl _gmtime64 (_In_ const __time64_t *_Time)
 
_CRTIMP struct tm *__cdecl _localtime64 (_In_ const __time64_t *_Time)
 
_CRTIMP __time64_t __cdecl _mktime64 (_Inout_ struct tm *_Tm)
 
_CRTIMP __time64_t __cdecl _mkgmtime64 (_Inout_ struct tm *_Tm)
 
_CRTIMP __time64_t __cdecl _time64 (_Out_opt_ __time64_t *_Time)
 
_CRTIMP errno_t __cdecl _ctime64_s (_Out_writes_z_(_SizeInBytes) char *_Buf, _In_ size_t _SizeInBytes, _In_ const __time64_t *_Time)
 
_CRTIMP errno_t __cdecl _gmtime64_s (_Out_ struct tm *_Tm, _In_ const __time64_t *_Time)
 
_CRTIMP errno_t __cdecl _localtime64_s (_Out_ struct tm *_Tm, _In_ const __time64_t *_Time)
 
_CRTIMP wchar_t *__cdecl _wasctime (_In_ const struct tm *_Tm)
 
_CRTIMP wchar_t *__cdecl _wctime (const time_t *_Time)
 
_CRTIMP wchar_t *__cdecl _wctime32 (_In_ const __time32_t *_Time)
 
_CRTIMP wchar_t *__cdecl _wstrdate (_Out_writes_z_(9) wchar_t *_Buffer)
 
_CRTIMP wchar_t *__cdecl _wstrtime (_Out_writes_z_(9) wchar_t *_Buffer)
 
_CRTIMP errno_t __cdecl _wasctime_s (_Out_writes_(_SizeInWords) _Post_readable_size_(26) wchar_t *_Buf, _In_range_(>=, 26) size_t _SizeInWords, _In_ const struct tm *_Tm)
 
_CRTIMP errno_t __cdecl _wstrdate_s (_Out_writes_(_SizeInWords) _Post_readable_size_(9) wchar_t *_Buf, _In_ size_t _SizeInWords)
 
_CRTIMP errno_t __cdecl _wstrtime_s (_Out_writes_(_SizeInWords) _Post_readable_size_(9) wchar_t *_Buf, _In_range_(>=, 9) size_t _SizeInWords)
 
_CRTIMP wchar_t *__cdecl _wctime64 (_In_ const __time64_t *_Time)
 
_CRTIMP double __cdecl difftime (time_t _Time1, time_t _Time2)
 
_CRTIMP char *__cdecl ctime (const time_t *_Time)
 
_CRTIMP struct tm *__cdecl gmtime (const time_t *_Time)
 
_CRTIMP struct tm *__cdecl localtime (const time_t *_Time)
 
_CRTIMP struct tm *__cdecl localtime_r (const time_t *_Time, struct tm *)
 
_CRTIMP time_t __cdecl mktime (struct tm *_Tm)
 
_CRTIMP time_t __cdecl _mkgmtime (struct tm *_Tm)
 
_CRTIMP time_t __cdecl time (time_t *_Time)
 
__CRT_INLINE errno_t __cdecl localtime_s (struct tm *_Tm, const time_t *_Time)
 
_CRTIMP void __cdecl tzset (void)
 

Variables

_In_ size_t _SizeInBytes
 
_In_ size_t _In_z_ _Printf_format_string_ const char_Format
 
_In_ size_t _In_z_ _Printf_format_string_ const char _In_ const struct tm_Tm
 
_In_ size_t _Max_size
 
_In_ size_t _In_z_ _Printf_format_string_ const char _In_ const struct tm _In_opt_ _locale_t _Locale
 
_In_ size_t _In_ const __time32_t_Time
 
_In_ size_t _SizeInWords
 
_CRTIMP int daylight
 
_CRTIMP long timezone
 
_CRTIMP chartzname [2]
 

Macro Definition Documentation

◆ _CLOCK_T_DEFINED

#define _CLOCK_T_DEFINED

This file has no copyright assigned and is placed in the Public Domain. This file is part of the w64 mingw-runtime package. No warranty is given; refer to the file DISCLAIMER within this package.

Definition at line 48 of file time.h.

◆ _INC_WTIME_INL

#define _INC_WTIME_INL

Definition at line 387 of file time.h.

◆ _TM_DEFINED

#define _TM_DEFINED

Definition at line 75 of file time.h.

◆ _WTIME_DEFINED

#define _WTIME_DEFINED

Definition at line 293 of file time.h.

◆ CLK_TCK

#define CLK_TCK   CLOCKS_PER_SEC

Definition at line 433 of file time.h.

◆ CLOCKS_PER_SEC

#define CLOCKS_PER_SEC   1000

Definition at line 89 of file time.h.

◆ NULL

#define NULL   ((void *)0)

Definition at line 70 of file time.h.

Typedef Documentation

◆ clock_t

typedef long clock_t

Definition at line 49 of file time.h.

Function Documentation

◆ _CRT_OBSOLETE()

_CRT_OBSOLETE ( GetLocalTime  )

◆ _CRTDATA() [1/3]

_CRTDATA ( extern int  _daylight)

◆ _CRTDATA() [2/3]

_CRTDATA ( extern long  _dstbias)

◆ _CRTDATA() [3/3]

_CRTDATA ( extern char _tzname[2])

◆ _ctime32()

_CRTIMP char* __cdecl _ctime32 ( _In_ const __time32_t _Time)

◆ _ctime64()

_CRTIMP char* __cdecl _ctime64 ( _In_ const __time64_t _Time)

Referenced by ctime().

◆ _ctime64_s()

_CRTIMP errno_t __cdecl _ctime64_s ( _Out_writes_z_(_SizeInBytes) char _Buf,
_In_ size_t  _SizeInBytes,
_In_ const __time64_t _Time 
)

◆ _difftime32()

_CRTIMP double __cdecl _difftime32 ( _In_ __time32_t  _Time1,
_In_ __time32_t  _Time2 
)

◆ _difftime64()

_Check_return_ _CRTIMP double __cdecl _difftime64 ( _In_ __time64_t  _Time1,
_In_ __time64_t  _Time2 
)

Referenced by difftime().

◆ _get_daylight()

_CRTIMP errno_t __cdecl _get_daylight ( _Out_ int _Daylight)

◆ _get_dstbias()

_CRTIMP errno_t __cdecl _get_dstbias ( _Out_ long _Daylight_savings_bias)

◆ _get_timezone()

_CRTIMP errno_t __cdecl _get_timezone ( _Out_ long _Timezone)

◆ _get_tzname()

_CRTIMP errno_t __cdecl _get_tzname ( _Out_ size_t _ReturnValue,
_Out_writes_z_(_SizeInBytes) char _Buffer,
_In_ size_t  _SizeInBytes,
_In_ int  _Index 
)

Referenced by _Strftime().

◆ _gmtime32()

◆ _gmtime32_s()

_Check_return_wat_ _CRTIMP errno_t __cdecl _gmtime32_s ( _In_ struct tm _Tm,
_In_ const __time32_t _Time 
)

◆ _gmtime64()

_CRTIMP struct tm* __cdecl _gmtime64 ( _In_ const __time64_t _Time)

Referenced by gmtime(), and mktime_worker().

◆ _gmtime64_s()

◆ _localtime32()

_CRTIMP struct tm* __cdecl _localtime32 ( _In_ const __time32_t _Time)

◆ _localtime32_s()

_CRTIMP errno_t __cdecl _localtime32_s ( _Out_ struct tm _Tm,
_In_ const __time32_t _Time 
)

◆ _localtime64()

_CRTIMP struct tm* __cdecl _localtime64 ( _In_ const __time64_t _Time)

Referenced by localtime().

◆ _localtime64_s()

◆ _mkgmtime()

__CRT_INLINE time_t __cdecl _mkgmtime ( struct tm _Tm)

Definition at line 427 of file time.h.

427 { return _mkgmtime64(_Tm); }
_CRTIMP __time64_t __cdecl _mkgmtime64(_Inout_ struct tm *_Tm)
_In_ size_t _In_z_ _Printf_format_string_ const char _In_ const struct tm * _Tm
Definition: time.h:156

Referenced by _tzset().

◆ _mkgmtime32()

_CRTIMP __time32_t __cdecl _mkgmtime32 ( _Inout_ struct tm _Tm)

◆ _mkgmtime64()

_CRTIMP __time64_t __cdecl _mkgmtime64 ( _Inout_ struct tm _Tm)

Referenced by _mkgmtime().

◆ _mktime32()

_CRTIMP __time32_t __cdecl _mktime32 ( _Inout_ struct tm _Tm)

◆ _mktime64()

_CRTIMP __time64_t __cdecl _mktime64 ( _Inout_ struct tm _Tm)

Referenced by ATL::CTime::CTime(), and mktime().

◆ _setsystime()

unsigned __cdecl _setsystime ( _In_ struct tm _Tm,
unsigned  _MilliSec 
)

◆ _strdate()

_CRTIMP char* __cdecl _strdate ( _Out_writes_z_(9) char _Buffer)

Referenced by test_strdate().

◆ _strdate_s()

◆ _strtime()

_CRTIMP char* __cdecl _strtime ( _Out_writes_z_(9) char _Buffer)

Referenced by test_strtime().

◆ _strtime_s()

◆ _Success_() [1/2]

_Success_ ( return  ,
 
)

◆ _Success_() [2/2]

_Success_ ( return  = = 0)

◆ _time32()

◆ _time64()

◆ _tzset()

_CRTIMP void __cdecl _tzset ( void  )

Definition at line 92 of file timezone.c.

93 {
94  const char * str;
95 
96  if (_tz_is_set)
97  {
98  return;
99  }
100 
101  /* Try to read the timezone from environment */
102  str = getenv("TZ");
103  if (str && str[0] != 0)
104  {
105  long hour = 0, min = 0, sec = 0;
106  size_t len = strnlen(str, 16);
107  int sign = 1;
108 
109  dst_begin = 0;
110 
111  for (;;)
112  {
113  /* Copy timezone name */
114  strncpy(tz_name, str, 3);
115  str += 3;
116  len -= 3;
117 
118  if (len < 1) break;
119 
120  if (*str == '+' || *str == '-')
121  {
122  sign = *str == '-' ? -1 : 1;
123  str++;
124  len--;
125  }
126 
127  if (len < 1) break;
128 
129  hour = atol(str);
130 
131  while (*str != 0 && *str != ':') str++;
132  if (*str == 0) break;
133 
134  min = atol(++str);
135 
136  while (*str != 0 && *str != ':') str++;
137  if (*str == 0) break;
138 
139  sec = atol(++str);
140 
141  while (*str != 0 && *str <= '9') str++;
142  if (*str == 0) break;
143 
144  /* Copy DST name */
145  strncpy(tz_dst_name, str, 3);
146 
147  // FIXME: set dst_begin etc
148 
149  /* We are finished */
150  break;
151  }
152 
153  _timezone = sign * (((hour * 60) + min) * 60 + sec);
154 
155  }
156  else
157  {
159  DWORD ret;
160 
161  ret = GetTimeZoneInformation(&tzi);
162  if (ret == TIME_ZONE_ID_INVALID)
163  {
164  return;
165  }
166 
168  0,
169  tzi.StandardName,
170  -1,
171  tz_name,
172  sizeof(tz_name),
173  NULL,
174  NULL);
175 
177  0,
178  tzi.DaylightName,
179  -1,
180  tz_dst_name,
181  sizeof(tz_dst_name),
182  NULL,
183  NULL);
184 
185  _timezone = tzi.Bias * 60;
186 
187  if (tzi.DaylightDate.wMonth)
188  {
189  struct tm _tm;
190 
191  _daylight = 1;
192  _dstbias = (tzi.DaylightBias - tzi.StandardBias) * 60;
193  _tm.tm_year = 70;
194  _tm.tm_mon = tzi.DaylightDate.wMonth - 1;
195  _tm.tm_mday = tzi.DaylightDate.wDay;
196  _tm.tm_hour = tzi.DaylightDate.wHour;
197  _tm.tm_min = tzi.DaylightDate.wMinute;
198  _tm.tm_sec = tzi.DaylightDate.wSecond;
199  dst_begin = (long)_mkgmtime(&_tm);
200  _tm.tm_mon = tzi.StandardDate.wMonth - 1;
201  _tm.tm_mday = tzi.StandardDate.wDay;
202  _tm.tm_hour = tzi.StandardDate.wHour;
203  _tm.tm_min = tzi.StandardDate.wMinute;
204  _tm.tm_sec = tzi.StandardDate.wSecond;
205  dst_end = (long)_mkgmtime(&_tm);
206  }
207  else
208  {
209  _daylight = 0;
210  _dstbias = 0;
211  }
212 
213  }
214  _tz_is_set = 1;
215 }
static size_t double int int int * sign
Definition: printf.c:69
DWORD WINAPI GetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation)
Definition: timezone.c:262
#define WideCharToMultiByte
Definition: compat.h:101
WORD wMonth
Definition: winbase.h:878
#define CP_ACP
Definition: compat.h:99
char _tz_is_set
Definition: timezone.c:10
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
#define TIME_ZONE_ID_INVALID
Definition: winbase.h:283
static char tz_name[64]
Definition: timezone.c:13
const WCHAR * str
WORD wMinute
Definition: winbase.h:882
smooth NULL
Definition: ftsmooth.c:416
_CRTIMP time_t __cdecl _mkgmtime(struct tm *_Tm)
Definition: time.h:427
long _dstbias
Definition: timezone.c:62
long dst_begin
Definition: timezone.c:16
unsigned long DWORD
Definition: ntddk_ex.h:95
_Check_return_ long __cdecl atol(_In_z_ const char *_Str)
WORD wSecond
Definition: winbase.h:883
int ret
int _daylight
Definition: timezone.c:30
GLenum GLsizei len
Definition: glext.h:6722
SYSTEMTIME StandardDate
Definition: winbase.h:1168
Definition: time.h:76
long dst_end
Definition: timezone.c:17
long _timezone
Definition: timezone.c:46
static char tz_dst_name[64]
Definition: timezone.c:14
WORD wDay
Definition: winbase.h:880
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
WCHAR DaylightName[32]
Definition: winbase.h:1170
#define long
Definition: qsort.c:33
WORD wHour
Definition: winbase.h:881
#define min(a, b)
Definition: monoChain.cc:55
WCHAR StandardName[32]
Definition: winbase.h:1167
SYSTEMTIME DaylightDate
Definition: winbase.h:1171

Referenced by _Strftime(), gettimeofday(), localtime(), and test__tzset().

◆ _wasctime()

_CRTIMP wchar_t* __cdecl _wasctime ( _In_ const struct tm _Tm)

◆ _wasctime_s()

_CRTIMP errno_t __cdecl _wasctime_s ( _Out_writes_(_SizeInWords) _Post_readable_size_(26) wchar_t _Buf,
_In_range_(>=, 26) size_t  _SizeInWords,
_In_ const struct tm _Tm 
)

◆ _wctime()

__CRT_INLINE wchar_t *__cdecl _wctime ( const time_t _Time)

Definition at line 392 of file time.h.

392 { return _wctime64(_Time); }
_CRTIMP wchar_t *__cdecl _wctime64(_In_ const __time64_t *_Time)
_In_ size_t _In_ const __time32_t * _Time
Definition: time.h:199

◆ _wctime32()

_CRTIMP wchar_t* __cdecl _wctime32 ( _In_ const __time32_t _Time)

◆ _wctime64()

_CRTIMP wchar_t* __cdecl _wctime64 ( _In_ const __time64_t _Time)

Referenced by _wctime().

◆ _wstrdate()

_CRTIMP wchar_t* __cdecl _wstrdate ( _Out_writes_z_(9) wchar_t _Buffer)

Referenced by test_wstrdate().

◆ _wstrdate_s()

_CRTIMP errno_t __cdecl _wstrdate_s ( _Out_writes_(_SizeInWords) _Post_readable_size_(9) wchar_t _Buf,
_In_ size_t  _SizeInWords 
)

◆ _wstrtime()

_CRTIMP wchar_t* __cdecl _wstrtime ( _Out_writes_z_(9) wchar_t _Buffer)

Referenced by test_wstrtime().

◆ _wstrtime_s()

_CRTIMP errno_t __cdecl _wstrtime_s ( _Out_writes_(_SizeInWords) _Post_readable_size_(9) wchar_t _Buf,
_In_range_(>=, 9) size_t  _SizeInWords 
)

◆ asctime()

◆ asctime_s()

◆ clock()

◆ ctime()

_CRTIMP char* __cdecl ctime ( const time_t _Time)

Definition at line 422 of file time.h.

422 { return _ctime64(_Time); }
_CRTIMP char *__cdecl _ctime64(_In_ const __time64_t *_Time)
_In_ size_t _In_ const __time32_t * _Time
Definition: time.h:199

◆ difftime()

__CRT_INLINE double __cdecl difftime ( time_t  _Time1,
time_t  _Time2 
)

Definition at line 421 of file time.h.

421 { return _difftime64(_Time1,_Time2); }
_Check_return_ _CRTIMP double __cdecl _difftime64(_In_ __time64_t _Time1, _In_ __time64_t _Time2)

◆ gmtime()

__CRT_INLINE struct tm *__cdecl gmtime ( const time_t _Time)

Definition at line 423 of file time.h.

423 { return _gmtime64(_Time); }
_CRTIMP struct tm *__cdecl _gmtime64(_In_ const __time64_t *_Time)
_In_ size_t _In_ const __time32_t * _Time
Definition: time.h:199

Referenced by convert_date_and_time(), getit(), GetUTCOffset(), GmTimeStr(), HTTP_HttpQueryInfoW(), iso9660_date(), iso9660_ldate(), localtime(), rdp_send_logon_info(), time_to_filetime(), and write_client_lease().

◆ localtime()

◆ localtime_r()

_CRTIMP struct tm* __cdecl localtime_r ( const time_t _Time,
struct tm  
)

◆ localtime_s()

__CRT_INLINE errno_t __cdecl localtime_s ( struct tm _Tm,
const time_t _Time 
)

Definition at line 425 of file time.h.

425 { return _localtime64_s(_Tm,_Time); }
_CRTIMP errno_t __cdecl _localtime64_s(_Out_ struct tm *_Tm, _In_ const __time64_t *_Time)
_In_ size_t _In_z_ _Printf_format_string_ const char _In_ const struct tm * _Tm
Definition: time.h:156
_In_ size_t _In_ const __time32_t * _Time
Definition: time.h:199

◆ mktime()

__CRT_INLINE time_t __cdecl mktime ( struct tm _Tm)

Definition at line 426 of file time.h.

426 { return _mktime64(_Tm); }
_In_ size_t _In_z_ _Printf_format_string_ const char _In_ const struct tm * _Tm
Definition: time.h:156
_CRTIMP __time64_t __cdecl _mktime64(_Inout_ struct tm *_Tm)

Referenced by __write_formatted_timeT(), ConvertTimeString(), get_ldate(), GetStartSpoolDate(), GetUTCOffset(), rdp_send_logon_info(), stime_arg1(), test_mktime(), UnDate(), UnDosLine(), UnLslRLine(), and UnMDTMDate().

◆ time()

_CRTIMP time_t __cdecl time ( time_t _Time)

Definition at line 428 of file time.h.

428 { return _time64(_Time); }
_CRTIMP __time64_t __cdecl _time64(_Out_opt_ __time64_t *_Time)
_In_ size_t _In_ const __time32_t * _Time
Definition: time.h:199

Referenced by FileTimeToUnixTime().

◆ tzset()

_CRTIMP void __cdecl tzset ( void  )

Referenced by init_client().

Variable Documentation

◆ _Format

Definition at line 154 of file time.h.

◆ _Locale

◆ _Max_size

_In_ size_t _Max_size

Definition at line 164 of file time.h.

◆ _SizeInBytes

_In_ size_t _SizeInBytes

Definition at line 154 of file time.h.

◆ _SizeInWords

_In_ size_t _SizeInWords

Definition at line 317 of file time.h.

◆ _Time

Definition at line 199 of file time.h.

Referenced by _wctime(), ctime(), gmtime(), localtime(), localtime_s(), and time().

◆ _Tm

◆ daylight

_CRTIMP int daylight

◆ timezone

◆ tzname

_CRTIMP char* tzname[2]