Author: gschneider Date: Thu Aug 6 02:26:23 2009 New Revision: 42413
URL: http://svn.reactos.org/svn/reactos?rev=42413&view=rev Log: -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
Modified: trunk/reactos/lib/sdk/crt/time_new/asctime.c trunk/reactos/lib/sdk/crt/time_new/ftime.c trunk/reactos/lib/sdk/crt/time_new/gmtime.c trunk/reactos/lib/sdk/crt/time_new/localtime.c
Modified: trunk/reactos/lib/sdk/crt/time_new/asctime.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/time_new/asctim... ============================================================================== --- trunk/reactos/lib/sdk/crt/time_new/asctime.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/time_new/asctime.c [iso-8859-1] Thu Aug 6 02:26:23 2009 @@ -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 short _TCHAR2; #endif
+#pragma pack(push,1) typedef union { _TCHAR text[26]; @@ -53,6 +55,7 @@ _TCHAR zt; }; } timebuf_t; +#pragma pack(pop)
_TCHAR2 static __inline__ @@ -80,13 +83,13 @@ 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 @@ (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 @@ _CRT_WIDE(__FILE__), __LINE__, 0); +#endif return EINVAL; }
Modified: trunk/reactos/lib/sdk/crt/time_new/ftime.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/time_new/ftime.... ============================================================================== --- trunk/reactos/lib/sdk/crt/time_new/ftime.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/time_new/ftime.c [iso-8859-1] Thu Aug 6 02:26:23 2009 @@ -27,11 +27,13 @@ /* Validate parameters */ if (!ptimeb) { +#if 0 _invalid_parameter(0, 0,//__FUNCTION__, _CRT_WIDE(__FILE__), __LINE__, 0); +#endif return EINVAL; }
Modified: trunk/reactos/lib/sdk/crt/time_new/gmtime.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/time_new/gmtime... ============================================================================== --- trunk/reactos/lib/sdk/crt/time_new/gmtime.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/time_new/gmtime.c [iso-8859-1] Thu Aug 6 02:26:23 2009 @@ -82,7 +82,7 @@ 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;
Modified: trunk/reactos/lib/sdk/crt/time_new/localtime.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/time_new/localt... ============================================================================== --- trunk/reactos/lib/sdk/crt/time_new/localtime.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/time_new/localtime.c [iso-8859-1] Thu Aug 6 02:26:23 2009 @@ -16,11 +16,13 @@ /* Validate parameters */ if (!_tm || !ptime) { +#if 0 _invalid_parameter(NULL, 0,//__FUNCTION__, _CRT_WIDE(__FILE__), __LINE__, 0); +#endif return EINVAL; }