mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 06:43:13 +00:00
-Deactivate _invalid_parameter for now, depends on the strsafe crt implementation also in AMD64 branch
-Fix the weekday offset in gmtime -Offset the year in *ctime by 1900, fix obvious typos -Set structure packing to char level: without it the 26 character array is 32 characters wide and the string can't be constructed properly because of alignment characters in between (shouldn't be a problem when _UNICODE is defined) -Test results: awesome, will be integrated soon svn path=/trunk/; revision=42413
This commit is contained in:
parent
2591c586a2
commit
de5d448389
4 changed files with 14 additions and 5 deletions
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#define DAYSPERWEEK 7
|
#define DAYSPERWEEK 7
|
||||||
#define MONSPERYEAR 12
|
#define MONSPERYEAR 12
|
||||||
|
#define HUNDREDYEAROFFSET 19
|
||||||
|
|
||||||
static const _TCHAR wday_name[DAYSPERWEEK][4] =
|
static const _TCHAR wday_name[DAYSPERWEEK][4] =
|
||||||
{
|
{
|
||||||
|
@ -33,6 +34,7 @@ typedef unsigned long _TCHAR4;
|
||||||
typedef unsigned short _TCHAR2;
|
typedef unsigned short _TCHAR2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#pragma pack(push,1)
|
||||||
typedef union
|
typedef union
|
||||||
{
|
{
|
||||||
_TCHAR text[26];
|
_TCHAR text[26];
|
||||||
|
@ -53,6 +55,7 @@ typedef union
|
||||||
_TCHAR zt;
|
_TCHAR zt;
|
||||||
};
|
};
|
||||||
} timebuf_t;
|
} timebuf_t;
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
_TCHAR2
|
_TCHAR2
|
||||||
static __inline__
|
static __inline__
|
||||||
|
@ -80,13 +83,13 @@ FillBuf(timebuf_t *buf, const struct tm *ptm)
|
||||||
buf->Month = *(_TCHAR4*)mon_name[ptm->tm_mon];
|
buf->Month = *(_TCHAR4*)mon_name[ptm->tm_mon];
|
||||||
buf->Day = IntToChar2(ptm->tm_mday);
|
buf->Day = IntToChar2(ptm->tm_mday);
|
||||||
buf->Space1 = ' ';
|
buf->Space1 = ' ';
|
||||||
buf->Hour = IntToChar2(ptm->tm_mday);
|
buf->Hour = IntToChar2(ptm->tm_hour);
|
||||||
buf->Sep1 = ':';
|
buf->Sep1 = ':';
|
||||||
buf->Minute = IntToChar2(ptm->tm_mday);
|
buf->Minute = IntToChar2(ptm->tm_min);
|
||||||
buf->Sep2 = ':';
|
buf->Sep2 = ':';
|
||||||
buf->Second = IntToChar2(ptm->tm_mday);
|
buf->Second = IntToChar2(ptm->tm_sec);
|
||||||
buf->Space2 = ' ';
|
buf->Space2 = ' ';
|
||||||
buf->Year[0] = IntToChar2(ptm->tm_year / 100);
|
buf->Year[0] = IntToChar2(ptm->tm_year / 100 + HUNDREDYEAROFFSET);
|
||||||
buf->Year[1] = IntToChar2(ptm->tm_year % 100);
|
buf->Year[1] = IntToChar2(ptm->tm_year % 100);
|
||||||
buf->lb = '\n';
|
buf->lb = '\n';
|
||||||
buf->zt = '\0';
|
buf->zt = '\0';
|
||||||
|
@ -116,6 +119,7 @@ _tasctime_s(
|
||||||
(unsigned int)ptm->tm_wday > 6 ||
|
(unsigned int)ptm->tm_wday > 6 ||
|
||||||
(unsigned int)ptm->tm_yday > 365)
|
(unsigned int)ptm->tm_yday > 365)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
_invalid_parameter(NULL,
|
_invalid_parameter(NULL,
|
||||||
#ifdef UNICODE
|
#ifdef UNICODE
|
||||||
L"_wasctime",
|
L"_wasctime",
|
||||||
|
@ -125,6 +129,7 @@ _tasctime_s(
|
||||||
_CRT_WIDE(__FILE__),
|
_CRT_WIDE(__FILE__),
|
||||||
__LINE__,
|
__LINE__,
|
||||||
0);
|
0);
|
||||||
|
#endif
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,11 +27,13 @@ _ftime_s(struct _timeb *ptimeb)
|
||||||
/* Validate parameters */
|
/* Validate parameters */
|
||||||
if (!ptimeb)
|
if (!ptimeb)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
_invalid_parameter(0,
|
_invalid_parameter(0,
|
||||||
0,//__FUNCTION__,
|
0,//__FUNCTION__,
|
||||||
_CRT_WIDE(__FILE__),
|
_CRT_WIDE(__FILE__),
|
||||||
__LINE__,
|
__LINE__,
|
||||||
0);
|
0);
|
||||||
|
#endif
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ _gmtime_worker(struct tm *ptm, __time64_t time, int do_dst)
|
||||||
ptm->tm_mday = 1 + dayinyear - padays[month];
|
ptm->tm_mday = 1 + dayinyear - padays[month];
|
||||||
|
|
||||||
/* Get weekday */
|
/* Get weekday */
|
||||||
ptm->tm_wday = (days + 4) % 7;
|
ptm->tm_wday = (days + 1) % 7;
|
||||||
|
|
||||||
/* Calculate hour and second in hour */
|
/* Calculate hour and second in hour */
|
||||||
ptm->tm_hour = secondinday / SECONDSPERHOUR;
|
ptm->tm_hour = secondinday / SECONDSPERHOUR;
|
||||||
|
|
|
@ -16,11 +16,13 @@ localtime_s(struct tm* _tm, const time_t *ptime)
|
||||||
/* Validate parameters */
|
/* Validate parameters */
|
||||||
if (!_tm || !ptime)
|
if (!_tm || !ptime)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
_invalid_parameter(NULL,
|
_invalid_parameter(NULL,
|
||||||
0,//__FUNCTION__,
|
0,//__FUNCTION__,
|
||||||
_CRT_WIDE(__FILE__),
|
_CRT_WIDE(__FILE__),
|
||||||
__LINE__,
|
__LINE__,
|
||||||
0);
|
0);
|
||||||
|
#endif
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue