ReactOS  0.4.15-dev-1386-g5cb9f87
localtime.c File Reference
#include <precomp.h>
#include <time.h>
#include "bitsfixup.h"
Include dependency graph for localtime.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _MAX__TIME64_T
 

Functions

errno_t localtime_s (struct tm *_tm, const time_t *ptime)
 
struct tmlocaltime (const time_t *ptime)
 

Variables

char _tz_is_set
 

Macro Definition Documentation

◆ _MAX__TIME64_T

#define _MAX__TIME64_T
Value:
0x793406fffLL /* number of seconds from
00:00:00, 01/01/1970 UTC to
23:59:59. 12/31/3000 UTC */
#define LL
Definition: tui.h:84

Definition at line 14 of file localtime.c.

Function Documentation

◆ localtime()

struct tm* localtime ( const time_t ptime)

Definition at line 49 of file localtime.c.

50 {
51  time_t time = *ptime;
52  struct tm * ptm;
53 
54  /* Check for invalid time value */
55  if (time < 0)
56  {
57  return 0;
58  }
59 
60  /* Never without */
61  if (!_tz_is_set)
62  _tzset();
63 
64  /* Check for overflow */
65 
66  /* Correct for timezone */
67  time -= _timezone;
68 #if 0
69  /* Correct for daylight saving */
70  if (_isdstime(time))
71  {
72  ptm->tm_isdst = 1;
73  time -= _dstbias;
74  }
75 #endif
76  ptm = gmtime(&time);
77 
78  return ptm;
79 }
_CRTIMP void __cdecl _tzset(void)
Definition: timezone.c:92
__u16 time
Definition: mkdosfs.c:366
char _tz_is_set
Definition: timezone.c:10
long _dstbias
Definition: timezone.c:62
Definition: time.h:76
long _timezone
Definition: timezone.c:46
__kernel_time_t time_t
Definition: linux.h:252
_CRTIMP struct tm *__cdecl gmtime(const time_t *_Time)
Definition: time.h:423
int tm_isdst
Definition: time.h:85

Referenced by localtime_s().

◆ localtime_s()

errno_t localtime_s ( struct tm _tm,
const time_t ptime 
)

Definition at line 19 of file localtime.c.

20 {
21  /* check for NULL */
22  if (!_tm || !ptime )
23  {
24  if(_tm) memset(_tm, 0xFF, sizeof(struct tm));
26  0,//__FUNCTION__,
27  _CRT_WIDE(__FILE__),
28  __LINE__,
29  0);
31  return EINVAL;
32  }
33 
34  /* Validate input */
35  if (*ptime < 0 || *ptime > _MAX__TIME64_T)
36  {
37  memset(_tm, 0xFF, sizeof(struct tm));
39  return EINVAL;
40  }
41 
42  _tm = localtime(ptime);
43  return 0;
44 }
errno_t __cdecl _set_errno(_In_ int _Value)
Definition: arc.h:39
Definition: time.h:76
#define _MAX__TIME64_T
Definition: localtime.c:14
#define NULL
Definition: types.h:112
struct tm * localtime(const time_t *ptime)
Definition: localtime.c:49
#define _CRT_WIDE(_String)
Definition: crtdefs.h:43
#define memset(x, y, z)
Definition: compat.h:39
void _invalid_parameter(const wchar_t *expression, const wchar_t *function, const wchar_t *file, unsigned int line, uintptr_t pReserved)
Definition: errno.c:137

Referenced by _tctime_s().

Variable Documentation

◆ _tz_is_set

char _tz_is_set

Definition at line 10 of file timezone.c.

Referenced by _tzset(), and localtime().