ReactOS 0.4.16-dev-2104-gb84fa49
time.h File Reference
#include <corecrt_wtime.h>
#include <pshpack8.h>
#include <poppack.h>
Include dependency graph for time.h:

Go to the source code of this file.

Classes

struct  _timespec32
 
struct  _timespec64
 
struct  timespec
 

Macros

#define _CLOCK_T_DEFINED
 
#define CLOCKS_PER_SEC   1000
 

Typedefs

typedef __msvcrt_long clock_t
 

Functions

_ACRTIMP unsigned __cdecl _getsystime (struct tm *)
 
_ACRTIMP unsigned __cdecl _setsystime (struct tm *, unsigned)
 
_ACRTIMP char *__cdecl _strdate (char *)
 
_ACRTIMP errno_t __cdecl _strdate_s (char *, size_t)
 
_ACRTIMP char *__cdecl _strtime (char *)
 
_ACRTIMP errno_t __cdecl _strtime_s (char *, size_t)
 
_ACRTIMP void __cdecl _tzset (void)
 
_ACRTIMP char *__cdecl asctime (const struct tm *)
 
_ACRTIMP clock_t __cdecl clock (void)
 
_ACRTIMP char *__cdecl _ctime32 (const __time32_t *)
 
_ACRTIMP errno_t __cdecl _ctime32_s (char *, size_t, const __time32_t *)
 
_ACRTIMP char *__cdecl _ctime64 (const __time64_t *)
 
_ACRTIMP errno_t __cdecl _ctime64_s (char *, size_t, const __time64_t *)
 
_ACRTIMP double __cdecl _difftime32 (__time32_t, __time32_t)
 
_ACRTIMP double __cdecl _difftime64 (__time64_t, __time64_t)
 
_ACRTIMP struct tm *__cdecl _gmtime32 (const __time32_t *)
 
_ACRTIMP int __cdecl _gmtime32_s (struct tm *res, const __time32_t *secs)
 
_ACRTIMP struct tm *__cdecl _gmtime64 (const __time64_t *)
 
_ACRTIMP int __cdecl _gmtime64_s (struct tm *res, const __time64_t *secs)
 
_ACRTIMP struct tm *__cdecl _localtime32 (const __time32_t *)
 
_ACRTIMP errno_t __cdecl _localtime32_s (struct tm *, const __time32_t *)
 
_ACRTIMP struct tm *__cdecl _localtime64 (const __time64_t *)
 
_ACRTIMP errno_t __cdecl _localtime64_s (struct tm *, const __time64_t *)
 
_ACRTIMP __time32_t __cdecl _mktime32 (struct tm *)
 
_ACRTIMP __time64_t __cdecl _mktime64 (struct tm *)
 
_ACRTIMP size_t __cdecl strftime (char *, size_t, const char *, const struct tm *)
 
_ACRTIMP size_t __cdecl _strftime_l (char *, size_t, const char *, const struct tm *, _locale_t)
 
_ACRTIMP __time32_t __cdecl _time32 (__time32_t *)
 
_ACRTIMP __time64_t __cdecl _time64 (__time64_t *)
 
static charctime (const time_t *t)
 
static errno_t ctime_s (char *res, size_t len, const __time64_t *t)
 
static double difftime (time_t t1, time_t t2)
 
static struct tmgmtime (const time_t *t)
 
static struct tmlocaltime (const time_t *t)
 
static errno_t localtime_s (struct tm *res, const time_t *t)
 
static time_t mktime (struct tm *tm)
 
static time_t time (time_t *t)
 

Variables

int _daylight
 
__msvcrt_long _dstbias
 
__msvcrt_long _timezone
 
char_tzname
 

Macro Definition Documentation

◆ _CLOCK_T_DEFINED

#define _CLOCK_T_DEFINED

Definition at line 29 of file time.h.

◆ CLOCKS_PER_SEC

#define CLOCKS_PER_SEC   1000

Definition at line 33 of file time.h.

Typedef Documentation

◆ clock_t

Definition at line 28 of file time.h.

Function Documentation

◆ _ctime32()

_ACRTIMP char *__cdecl _ctime32 ( const __time32_t time)

Definition at line 1751 of file time.c.

1752{
1753 struct tm *t;
1754 t = _localtime32( time );
1755 if (!t) return NULL;
1756 return asctime( t );
1757}
#define NULL
Definition: types.h:112
char *CDECL asctime(const struct tm *mstm)
Definition: time.c:1636
struct tm *CDECL _localtime32(const __time32_t *secs)
Definition: time.c:430
GLdouble GLdouble t
Definition: gl.h:2047
__u16 time
Definition: mkdosfs.c:8

◆ _ctime32_s()

_ACRTIMP errno_t __cdecl _ctime32_s ( char res,
size_t  len,
const __time32_t time 
)

Definition at line 1762 of file time.c.

1763{
1764 struct tm t;
1765 int ret;
1766
1767 if (!MSVCRT_CHECK_PMT( res != NULL )) return EINVAL;
1768 if (!MSVCRT_CHECK_PMT( len >= 26 )) return EINVAL;
1769 res[0] = '\0';
1770 if (!MSVCRT_CHECK_PMT( time != NULL )) return EINVAL;
1771 if (!MSVCRT_CHECK_PMT( *time > 0 )) return EINVAL;
1772
1773 ret = _localtime32_s( &t, time );
1774 if (ret)
1775 return ret;
1776 return asctime_s( res, len, &t );
1777}
#define EINVAL
Definition: errno.h:44
#define MSVCRT_CHECK_PMT(x)
Definition: msvcrt.h:378
int CDECL _localtime32_s(struct tm *time, const __time32_t *secs)
Definition: time.c:444
int CDECL asctime_s(char *time, size_t size, const struct tm *mstm)
Definition: time.c:1655
return ret
Definition: mutex.c:146
GLuint res
Definition: glext.h:9613
GLenum GLsizei len
Definition: glext.h:6722

◆ _ctime64()

_ACRTIMP char *__cdecl _ctime64 ( const __time64_t time)

Definition at line 1720 of file time.c.

1721{
1722 struct tm *t;
1723 t = _localtime64( time );
1724 if (!t) return NULL;
1725 return asctime( t );
1726}
struct tm *CDECL _localtime64(const __time64_t *secs)
Definition: time.c:415

Referenced by _CRT_INSECURE_DEPRECATE(), and ctime().

◆ _ctime64_s()

_ACRTIMP errno_t __cdecl _ctime64_s ( char res,
size_t  len,
const __time64_t time 
)

Definition at line 1731 of file time.c.

1732{
1733 struct tm t;
1734 int ret;
1735
1736 if (!MSVCRT_CHECK_PMT( res != NULL )) return EINVAL;
1737 if (!MSVCRT_CHECK_PMT( len >= 26 )) return EINVAL;
1738 res[0] = '\0';
1739 if (!MSVCRT_CHECK_PMT( time != NULL )) return EINVAL;
1740 if (!MSVCRT_CHECK_PMT( *time > 0 )) return EINVAL;
1741
1742 ret = _localtime64_s( &t, time );
1743 if (ret)
1744 return ret;
1745 return asctime_s( res, len, &t );
1746}
int CDECL _localtime64_s(struct tm *res, const __time64_t *secs)
Definition: time.c:367

Referenced by ctime_s().

◆ _difftime32()

_ACRTIMP double __cdecl _difftime32 ( __time32_t  time1,
__time32_t  time2 
)

Definition at line 717 of file time.c.

718{
719 return (double)(time1 - time2);
720}

◆ _difftime64()

_ACRTIMP double __cdecl _difftime64 ( __time64_t  time1,
__time64_t  time2 
)

Definition at line 709 of file time.c.

710{
711 return (double)(time1 - time2);
712}

Referenced by difftime().

◆ _getsystime()

_ACRTIMP unsigned __cdecl _getsystime ( struct tm tp)

Definition at line 18 of file systime.c.

19{
21 int i;
22 DWORD TimeZoneId;
23 TIME_ZONE_INFORMATION TimeZoneInformation;
24
26
27 tp->tm_year = Time.wYear - 1900;
28 tp->tm_mon = Time.wMonth - 1;
29 tp->tm_wday = Time.wDayOfWeek;
30 tp->tm_mday = Time.wDay;
31 tp->tm_hour = Time.wHour;
32 tp->tm_min = Time.wMinute;
33 tp->tm_sec = Time.wSecond;
34
35 tp->tm_isdst = -1;
36
37 TimeZoneId = GetTimeZoneInformation(&TimeZoneInformation);
38 if (TimeZoneId == TIME_ZONE_ID_DAYLIGHT){
39 tp->tm_isdst = 1;
40 }
41 else
42 tp->tm_isdst = 0;
43
44 if (tp->tm_year % 4 == 0) {
45 if (tp->tm_year % 100 != 0)
46 tp->tm_yday = 1;
47 else if ((tp->tm_year-100) % 1000 == 0)
48 tp->tm_yday = 1;
49 }
50
51 for (i = 0; i <= tp->tm_mon; i++)
52 tp->tm_yday += month[i];
53
54 return Time.wMilliseconds;
55}
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:286
DWORD WINAPI GetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation)
Definition: timezone.c:262
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2996
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static PLARGE_INTEGER Time
Definition: time.c:105
#define TIME_ZONE_ID_DAYLIGHT
Definition: rtltypes.h:254
int month[12]
Definition: systime.c:13

◆ _gmtime32()

_ACRTIMP struct tm *__cdecl _gmtime32 ( const __time32_t secs)

Definition at line 538 of file time.c.

539{
540 __time64_t secs64;
541
542 if(!secs)
543 return NULL;
544
545 secs64 = *secs;
546 return _gmtime64( &secs64 );
547}
struct tm *CDECL _gmtime64(const __time64_t *secs)
Definition: time.c:509
__int64 __time64_t
Definition: corecrt.h:619

Referenced by test_gmtime64().

◆ _gmtime32_s()

_ACRTIMP int __cdecl _gmtime32_s ( struct tm res,
const __time32_t secs 
)

Definition at line 524 of file time.c.

525{
526 __time64_t secs64;
527
528 if(secs) {
529 secs64 = *secs;
530 return _gmtime64_s(res, &secs64);
531 }
532 return _gmtime64_s(res, NULL);
533}
int CDECL _gmtime64_s(struct tm *res, const __time64_t *secs)
Definition: time.c:464

Referenced by test_gmtime64().

◆ _gmtime64()

_ACRTIMP struct tm *__cdecl _gmtime64 ( const __time64_t secs)

Definition at line 509 of file time.c.

510{
512
513 if(!data->time_buffer)
514 data->time_buffer = malloc(sizeof(struct tm));
515
516 if(_gmtime64_s(data->time_buffer, secs))
517 return NULL;
518 return data->time_buffer;
519}
#define malloc
Definition: debug_ros.c:4
thread_data_t *CDECL msvcrt_get_thread_data(void)
Definition: thread.c:45
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

Referenced by _CRT_INSECURE_DEPRECATE(), _gmtime32(), gmtime(), mktime_worker(), and test_gmtime64().

◆ _gmtime64_s()

_ACRTIMP int __cdecl _gmtime64_s ( struct tm res,
const __time64_t secs 
)

Definition at line 464 of file time.c.

465{
466 int i;
467 FILETIME ft;
468 SYSTEMTIME st;
470
471 TRACE("res %p, secs %p (%I64d).\n", res, secs, secs ? *secs : 0);
472
473 if (!res || !secs || *secs < MIN_GMTIME64_TIME || *secs > MAX_GMTIME64_TIME) {
474 if (res) {
476 }
477
478 *_errno() = EINVAL;
479 return EINVAL;
480 }
481
483
484 ft.dwHighDateTime = (UINT)(time >> 32);
485 ft.dwLowDateTime = (UINT)time;
486
487 FileTimeToSystemTime(&ft, &st);
488
489 res->tm_sec = st.wSecond;
490 res->tm_min = st.wMinute;
491 res->tm_hour = st.wHour;
492 res->tm_mday = st.wDay;
493 res->tm_year = st.wYear - 1900;
494 res->tm_mon = st.wMonth - 1;
495 res->tm_wday = st.wDayOfWeek;
496 for (i = res->tm_yday = 0; i < st.wMonth - 1; i++) {
497 res->tm_yday += MonthLengths[IsLeapYear(st.wYear)][i];
498 }
499
500 res->tm_yday += st.wDay - 1;
501 res->tm_isdst = 0;
502
503 return 0;
504}
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:188
int *CDECL _errno(void)
Definition: errno.c:215
#define TICKSPERSEC
Definition: time.c:236
#define TICKS_1601_TO_1970
Definition: time.c:238
#define MAX_GMTIME64_TIME
Definition: time.c:71
static void write_invalid_msvcrt_tm(struct tm *tm)
Definition: time.c:85
static const int MonthLengths[2][12]
Definition: time.c:57
unsigned int UINT
Definition: ndis.h:50
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwHighDateTime
Definition: mapidefs.h:66
DWORD dwLowDateTime
Definition: mapidefs.h:65
WORD wSecond
Definition: minwinbase.h:262
WORD wMinute
Definition: minwinbase.h:261
WORD wDayOfWeek
Definition: minwinbase.h:258
uint64_t ULONGLONG
Definition: typedefs.h:67
#define IsLeapYear(y)
Definition: variant.c:1048

Referenced by _gmtime32_s(), _gmtime64(), ATL::CTime::FormatGmt(), ATL::CTime::GetAsDBTIMESTAMP(), ATL::CTime::GetAsSystemTime(), ATL::CTime::GetGmtTm(), and test_gmtime64().

◆ _localtime32()

_ACRTIMP struct tm *__cdecl _localtime32 ( const __time32_t secs)

Definition at line 430 of file time.c.

431{
432 __time64_t secs64;
433
434 if(!secs)
435 return NULL;
436
437 secs64 = *secs;
438 return _localtime64( &secs64 );
439}

Referenced by _ctime32(), and _wctime32().

◆ _localtime32_s()

_ACRTIMP errno_t __cdecl _localtime32_s ( struct tm time,
const __time32_t secs 
)

Definition at line 444 of file time.c.

445{
446 __time64_t secs64;
447
448 if (!time || !secs || *secs < 0)
449 {
450 if (time)
452
453 *_errno() = EINVAL;
454 return EINVAL;
455 }
456
457 secs64 = *secs;
458 return _localtime64_s(time, &secs64);
459}

Referenced by _ctime32_s(), and _wctime32_s().

◆ _localtime64()

_ACRTIMP struct tm *__cdecl _localtime64 ( const __time64_t secs)

Definition at line 415 of file time.c.

416{
418
419 if(!data->time_buffer)
420 data->time_buffer = malloc(sizeof(struct tm));
421
422 if(_localtime64_s(data->time_buffer, secs))
423 return NULL;
424 return data->time_buffer;
425}

Referenced by _ctime64(), _localtime32(), _wctime64(), and localtime().

◆ _localtime64_s()

_ACRTIMP errno_t __cdecl _localtime64_s ( struct tm res,
const __time64_t secs 
)

Definition at line 367 of file time.c.

368{
369 int i;
370 FILETIME ft;
371 SYSTEMTIME st;
373
374 if (!res || !secs || *secs < 0 || *secs > _MAX__TIME64_T)
375 {
376 if (res)
378
379 *_errno() = EINVAL;
380 return EINVAL;
381 }
382
383 _tzset_init();
385
386 ft.dwHighDateTime = (UINT)(time >> 32);
387 ft.dwLowDateTime = (UINT)time;
388 FileTimeToSystemTime(&ft, &st);
389
390 res->tm_isdst = is_dst(&st) ? 1 : 0;
391 if(res->tm_isdst) {
393 ft.dwHighDateTime = (UINT)(time >> 32);
394 ft.dwLowDateTime = (UINT)time;
395 FileTimeToSystemTime(&ft, &st);
396 }
397
398 res->tm_sec = st.wSecond;
399 res->tm_min = st.wMinute;
400 res->tm_hour = st.wHour;
401 res->tm_mday = st.wDay;
402 res->tm_year = st.wYear - 1900;
403 res->tm_mon = st.wMonth - 1;
404 res->tm_wday = st.wDayOfWeek;
405 for (i = res->tm_yday = 0; i < st.wMonth - 1; i++)
406 res->tm_yday += MonthLengths[IsLeapYear(st.wYear)][i];
407 res->tm_yday += st.wDay - 1;
408
409 return 0;
410}
#define _MAX__TIME64_T
Definition: msvcrt.h:339
__msvcrt_long MSVCRT___timezone
Definition: time.c:106
static void _tzset_init(void)
Definition: time.c:182
__msvcrt_long MSVCRT__dstbias
Definition: time.c:111
static BOOL is_dst(const SYSTEMTIME *st)
Definition: time.c:196

Referenced by _ctime64_s(), _localtime32_s(), _localtime64(), _wctime64_s(), ATL::CTimeSpan::Format(), ATL::CTime::Format(), ATL::CTime::GetDay(), ATL::CTime::GetDayOfWeek(), ATL::CTime::GetHour(), ATL::CTime::GetLocalTm(), ATL::CTime::GetMinute(), ATL::CTime::GetMonth(), ATL::CTime::GetSecond(), ATL::CTime::GetYear(), and localtime_s().

◆ _mktime32()

_ACRTIMP __time32_t __cdecl _mktime32 ( struct tm mstm)

Definition at line 339 of file time.c.

340{
341 __time64_t ret = _mktime64( mstm );
342 return ret == (__time32_t)ret ? ret : -1;
343}
__msvcrt_long __time32_t
Definition: corecrt.h:209
__time64_t CDECL _mktime64(struct tm *mstm)
Definition: time.c:331

Referenced by _getsystime(), and _setsystime().

◆ _mktime64()

_ACRTIMP __time64_t __cdecl _mktime64 ( struct tm mstm)

Definition at line 331 of file time.c.

332{
333 return mktime_helper(mstm, TRUE);
334}
#define TRUE
Definition: types.h:120
static __time64_t mktime_helper(struct tm *mstm, BOOL local)
Definition: time.c:240

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

◆ _setsystime()

_ACRTIMP unsigned __cdecl _setsystime ( struct tm source,
unsigned  milliseconds 
)

Definition at line 41 of file systime.cpp.

42{
43 _ASSERTE(source != nullptr);
44 if (source == nullptr)
46
47 // Normalize uninitialized fields:
49
51 local_time.wYear = static_cast<WORD>(source->tm_year + 1900);
52 local_time.wMonth = static_cast<WORD>(source->tm_mon + 1);
53 local_time.wDay = static_cast<WORD>(source->tm_mday);
54 local_time.wHour = static_cast<WORD>(source->tm_hour);
55 local_time.wMinute = static_cast<WORD>(source->tm_min);
56 local_time.wSecond = static_cast<WORD>(source->tm_sec);
57 local_time.wMilliseconds = static_cast<WORD>(milliseconds);
58
60 return static_cast<int>(GetLastError());
61
62 return 0;
63}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
static DOUBLE local_time(DOUBLE time, DateInstance *date)
Definition: date.c:351
BOOL WINAPI SetLocalTime(IN CONST SYSTEMTIME *lpSystemTime)
Definition: time.c:356
#define _ASSERTE(expr)
Definition: crtdbg.h:57
_ACRTIMP __time32_t __cdecl _mktime32(struct tm *)
Definition: time.c:339
unsigned short WORD
Definition: ntddk_ex.h:93
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

◆ _strdate()

_ACRTIMP char *__cdecl _strdate ( char date)

Definition at line 552 of file time.c.

553{
554 SYSTEMTIME st;
555
556 GetLocalTime(&st);
557 date[0] = '0' + st.wMonth / 10;
558 date[1] = '0' + st.wMonth % 10;
559 date[2] = '/';
560 date[3] = '0' + st.wDay / 10;
561 date[4] = '0' + st.wDay % 10;
562 date[5] = '/';
563 date[6] = '0' + st.wYear / 10 % 10;
564 date[7] = '0' + st.wYear % 10;
565 date[8] = 0;
566 return date;
567}
__u16 date
Definition: mkdosfs.c:8

◆ _strdate_s()

_ACRTIMP errno_t __cdecl _strdate_s ( char date,
size_t  size 
)

Definition at line 572 of file time.c.

573{
574 if(date && size)
575 date[0] = '\0';
576
577 if(!date) {
578 *_errno() = EINVAL;
579 return EINVAL;
580 }
581
582 if(size < 9) {
583 *_errno() = ERANGE;
584 return ERANGE;
585 }
586
587 _strdate(date);
588 return 0;
589}
#define ERANGE
Definition: errno.h:55
GLsizeiptr size
Definition: glext.h:5919
_strdate
Definition: time.h:297

◆ _strftime_l()

_ACRTIMP size_t __cdecl _strftime_l ( char ,
size_t  ,
const char ,
const struct tm ,
_locale_t   
)

◆ _strtime()

_ACRTIMP char *__cdecl _strtime ( char time)

Definition at line 625 of file time.c.

626{
627 SYSTEMTIME st;
628
629 GetLocalTime(&st);
630 time[0] = '0' + st.wHour / 10;
631 time[1] = '0' + st.wHour % 10;
632 time[2] = ':';
633 time[3] = '0' + st.wMinute / 10;
634 time[4] = '0' + st.wMinute % 10;
635 time[5] = ':';
636 time[6] = '0' + st.wSecond / 10;
637 time[7] = '0' + st.wSecond % 10;
638 time[8] = 0;
639 return time;
640}

◆ _strtime_s()

_ACRTIMP errno_t __cdecl _strtime_s ( char time,
size_t  size 
)

Definition at line 645 of file time.c.

646{
647 if(time && size)
648 time[0] = '\0';
649
650 if(!time) {
651 *_errno() = EINVAL;
652 return EINVAL;
653 }
654
655 if(size < 9) {
656 *_errno() = ERANGE;
657 return ERANGE;
658 }
659
660 _strtime(time);
661 return 0;
662}
_strtime
Definition: time.h:313

◆ _time32()

_ACRTIMP __time32_t __cdecl _time32 ( __time32_t buf)

Definition at line 794 of file time.c.

795{
796 __time32_t curtime;
797 struct __timeb64 tb;
798
799 _ftime64(&tb);
800
801 curtime = tb.time;
802 return buf ? *buf = curtime : curtime;
803}
void CDECL _ftime64(struct __timeb64 *buf)
Definition: time.c:725
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static const WCHAR tb[]
Definition: suminfo.c:285

◆ _time64()

_ACRTIMP __time64_t __cdecl _time64 ( __time64_t buf)

Definition at line 780 of file time.c.

781{
782 __time64_t curtime;
783 struct __timeb64 tb;
784
785 _ftime64(&tb);
786
787 curtime = tb.time;
788 return buf ? *buf = curtime : curtime;
789}

Referenced by _futime64(), ATL::CTime::GetCurrentTime(), and time().

◆ _tzset()

_ACRTIMP void __cdecl _tzset ( void  )

Definition at line 127 of file time.c.

128{
129 char *tz = getenv("TZ");
130 BOOL error;
131
133 if(tz && tz[0]) {
134 BOOL neg_zone = FALSE;
135
136 memset(&tzi, 0, sizeof(tzi));
137
138 /* Parse timezone information: tzn[+|-]hh[:mm[:ss]][dzn] */
140 tz += 3;
141
142 if(*tz == '-') {
143 neg_zone = TRUE;
144 tz++;
145 }else if(*tz == '+') {
146 tz++;
147 }
148 MSVCRT___timezone = strtol(tz, &tz, 10)*3600;
149 if(*tz == ':') {
150 MSVCRT___timezone += strtol(tz+1, &tz, 10)*60;
151 if(*tz == ':')
152 MSVCRT___timezone += strtol(tz+1, &tz, 10);
153 }
154 if(neg_zone)
156
163
167 }else {
169 MSVCRT__dstbias = 0;
170 }
171
173 sizeof(tzname_std), NULL, &error) || error)
174 *MSVCRT__tzname[0] = 0;
176 sizeof(tzname_dst), NULL, &error) || error)
177 *MSVCRT__tzname[0] = 0;
178 }
180}
#define FALSE
Definition: types.h:117
#define CP_ACP
Definition: compat.h:109
#define lstrcpynA
Definition: compat.h:751
#define WideCharToMultiByte
Definition: compat.h:111
char *CDECL getenv(const char *name)
Definition: environ.c:227
_ACRTIMP __msvcrt_long __cdecl strtol(const char *, char **, int)
Definition: string.c:1833
void CDECL _lock(int locknum)
Definition: lock.c:85
void CDECL _unlock(int locknum)
Definition: lock.c:114
#define _TIME_LOCK
Definition: mtdll.h:35
int MSVCRT___daylight
Definition: time.c:101
static char tzname_std[64]
Definition: time.c:119
static char tzname_dst[64]
Definition: time.c:120
static TIME_ZONE_INFORMATION tzi
Definition: time.c:123
char * MSVCRT__tzname[2]
Definition: time.c:121
unsigned int BOOL
Definition: ntddk_ex.h:94
GLbyte GLbyte tz
Definition: glext.h:8756
#define error(str)
Definition: mkdosfs.c:1605
#define memset(x, y, z)
Definition: compat.h:39
SYSTEMTIME DaylightDate
Definition: winbase.h:936
WCHAR DaylightName[32]
Definition: winbase.h:935
WCHAR StandardName[32]
Definition: winbase.h:932
SYSTEMTIME StandardDate
Definition: winbase.h:933
#define TIME_ZONE_ID_INVALID
Definition: winbase.h:310

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

◆ asctime()

_ACRTIMP char *__cdecl asctime ( const struct tm mstm)

Definition at line 1636 of file time.c.

1637{
1639
1640 /* asctime returns date in format that always has exactly 26 characters */
1641 if (!data->asctime_buffer) {
1642 data->asctime_buffer = malloc(26);
1643 if (!data->asctime_buffer) {
1644 *_errno() = ENOMEM;
1645 return NULL;
1646 }
1647 }
1648
1649 return asctime_buf(data->asctime_buffer, mstm);
1650}
#define ENOMEM
Definition: errno.h:35
static char * asctime_buf(char *buf, const struct tm *mstm)
Definition: time.c:1603

Referenced by _ctime32(), _ctime64(), ConvertTimeString(), create_msft_typelib(), DaytimeHandler(), kbd_c(), kbd_h(), Test_asctime(), and test_asctime().

◆ clock()

◆ ctime()

static char * ctime ( const time_t t)
inlinestatic

Definition at line 117 of file time.h.

117{ return _ctime64(t); }
_ACRTIMP char *__cdecl _ctime64(const __time64_t *)
Definition: time.c:1720

◆ ctime_s()

static errno_t ctime_s ( char res,
size_t  len,
const __time64_t t 
)
inlinestatic

Definition at line 118 of file time.h.

118{ return _ctime64_s(res, len, t); }
_ACRTIMP errno_t __cdecl _ctime64_s(char *, size_t, const __time64_t *)
Definition: time.c:1731

◆ difftime()

static double difftime ( time_t  t1,
time_t  t2 
)
inlinestatic

Definition at line 119 of file time.h.

119{ return _difftime64(t1, t2); }
_ACRTIMP double __cdecl _difftime64(__time64_t, __time64_t)
Definition: time.c:709

◆ gmtime()

static struct tm * gmtime ( const time_t t)
inlinestatic

Definition at line 120 of file time.h.

120{ return _gmtime64(t); }
_ACRTIMP struct tm *__cdecl _gmtime64(const __time64_t *)
Definition: time.c:509

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

◆ localtime()

◆ localtime_s()

static errno_t localtime_s ( struct tm res,
const time_t t 
)
inlinestatic

Definition at line 122 of file time.h.

122{ return _localtime64_s(res, t); }
_ACRTIMP errno_t __cdecl _localtime64_s(struct tm *, const __time64_t *)
Definition: time.c:367

◆ mktime()

static time_t mktime ( struct tm tm)
inlinestatic

Definition at line 123 of file time.h.

123{ return _mktime64(tm); }
_ACRTIMP __time64_t __cdecl _mktime64(struct tm *)
Definition: time.c:331

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

◆ strftime()

_ACRTIMP size_t __cdecl strftime ( char str,
size_t  max,
const char format,
const struct tm mstm 
)

Definition at line 1537 of file time.c.

1539{
1540 return strftime_helper(str, max, format, mstm, NULL, NULL);
1541}
static size_t strftime_helper(char *str, size_t max, const char *format, const struct tm *mstm, __lc_time_data *time_data, _locale_t loc)
Definition: time.c:1466
const WCHAR * str
Definition: format.c:58
#define max(a, b)
Definition: svc.c:63

Referenced by add_special_defines(), file_stat(), file_write_http_header(), ATL::CTimeSpan::Format(), ATL::CTime::Format(), ATL::CTime::FormatGmt(), init(), InitLsMonths(), kbd_rc(), logMess(), main(), NcFTPConfirmResumeDownloadProc(), NcFTPConfirmResumeUploadProc(), SpoolName(), test_strftime(), TRIO_ARGS4(), wcsftime(), and xmlMemDisplay().

◆ time()

static time_t time ( time_t t)
inlinestatic

Definition at line 124 of file time.h.

124{ return _time64(t); }
_ACRTIMP __time64_t __cdecl _time64(__time64_t *)
Definition: time.c:780

Variable Documentation

◆ _daylight

int _daylight
extern

◆ _dstbias

__msvcrt_long _dstbias
extern

Definition at line 62 of file timezone.c.

Referenced by __acrt_initialize_timeset(), __dstbias(), __p__dstbias(), _get_dstbias(), and _tzset().

◆ _timezone

__msvcrt_long _timezone
extern

◆ _tzname

char* _tzname
extern

Definition at line 22 of file timezone.c.

Referenced by __p__tzname().