mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 17:25:55 +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 MONSPERYEAR 12
|
||||
#define HUNDREDYEAROFFSET 19
|
||||
|
||||
static const _TCHAR wday_name[DAYSPERWEEK][4] =
|
||||
{
|
||||
|
@ -33,6 +34,7 @@ typedef unsigned long _TCHAR4;
|
|||
typedef unsigned short _TCHAR2;
|
||||
#endif
|
||||
|
||||
#pragma pack(push,1)
|
||||
typedef union
|
||||
{
|
||||
_TCHAR text[26];
|
||||
|
@ -53,6 +55,7 @@ typedef union
|
|||
_TCHAR zt;
|
||||
};
|
||||
} timebuf_t;
|
||||
#pragma pack(pop)
|
||||
|
||||
_TCHAR2
|
||||
static __inline__
|
||||
|
@ -80,13 +83,13 @@ FillBuf(timebuf_t *buf, const struct tm *ptm)
|
|||
buf->Month = *(_TCHAR4*)mon_name[ptm->tm_mon];
|
||||
buf->Day = IntToChar2(ptm->tm_mday);
|
||||
buf->Space1 = ' ';
|
||||
buf->Hour = IntToChar2(ptm->tm_mday);
|
||||
buf->Hour = IntToChar2(ptm->tm_hour);
|
||||
buf->Sep1 = ':';
|
||||
buf->Minute = IntToChar2(ptm->tm_mday);
|
||||
buf->Minute = IntToChar2(ptm->tm_min);
|
||||
buf->Sep2 = ':';
|
||||
buf->Second = IntToChar2(ptm->tm_mday);
|
||||
buf->Second = IntToChar2(ptm->tm_sec);
|
||||
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->lb = '\n';
|
||||
buf->zt = '\0';
|
||||
|
@ -116,6 +119,7 @@ _tasctime_s(
|
|||
(unsigned int)ptm->tm_wday > 6 ||
|
||||
(unsigned int)ptm->tm_yday > 365)
|
||||
{
|
||||
#if 0
|
||||
_invalid_parameter(NULL,
|
||||
#ifdef UNICODE
|
||||
L"_wasctime",
|
||||
|
@ -125,6 +129,7 @@ _tasctime_s(
|
|||
_CRT_WIDE(__FILE__),
|
||||
__LINE__,
|
||||
0);
|
||||
#endif
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,11 +27,13 @@ _ftime_s(struct _timeb *ptimeb)
|
|||
/* Validate parameters */
|
||||
if (!ptimeb)
|
||||
{
|
||||
#if 0
|
||||
_invalid_parameter(0,
|
||||
0,//__FUNCTION__,
|
||||
_CRT_WIDE(__FILE__),
|
||||
__LINE__,
|
||||
0);
|
||||
#endif
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ _gmtime_worker(struct tm *ptm, __time64_t time, int do_dst)
|
|||
ptm->tm_mday = 1 + dayinyear - padays[month];
|
||||
|
||||
/* Get weekday */
|
||||
ptm->tm_wday = (days + 4) % 7;
|
||||
ptm->tm_wday = (days + 1) % 7;
|
||||
|
||||
/* Calculate hour and second in hour */
|
||||
ptm->tm_hour = secondinday / SECONDSPERHOUR;
|
||||
|
|
|
@ -16,11 +16,13 @@ localtime_s(struct tm* _tm, const time_t *ptime)
|
|||
/* Validate parameters */
|
||||
if (!_tm || !ptime)
|
||||
{
|
||||
#if 0
|
||||
_invalid_parameter(NULL,
|
||||
0,//__FUNCTION__,
|
||||
_CRT_WIDE(__FILE__),
|
||||
__LINE__,
|
||||
0);
|
||||
#endif
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue