Author: sserapion
Date: Sat Aug 30 22:22:13 2008
New Revision: 35829
URL:
http://svn.reactos.org/svn/reactos?rev=35829&view=rev
Log:
Make crt call win32 time APIs, like WINE
Modified:
branches/ros-amd64-bringup/reactos/lib/sdk/crt/time/strdate.c
branches/ros-amd64-bringup/reactos/lib/sdk/crt/time/strtime.c
branches/ros-amd64-bringup/reactos/lib/sdk/crt/time/wstrdate.c
branches/ros-amd64-bringup/reactos/lib/sdk/crt/time/wstrtime.c
Modified: branches/ros-amd64-bringup/reactos/lib/sdk/crt/time/strdate.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/s…
==============================================================================
--- branches/ros-amd64-bringup/reactos/lib/sdk/crt/time/strdate.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/time/strdate.c [iso-8859-1] Sat Aug 30
22:22:13 2008
@@ -12,18 +12,12 @@
/*
* @implemented
*/
-char* _strdate(char* datestr)
+char* _strdate(char* date)
{
- time_t t;
- struct tm* d;
- char* dt = (char*)datestr;
+ static const char format[] = "MM'/'dd'/'yy";
- if (datestr == NULL) {
- __set_errno(EINVAL);
- return NULL;
- }
- t = time(NULL);
- d = localtime(&t);
- sprintf(dt,"%d/%d/%d",d->tm_mday,d->tm_mon+1,d->tm_year);
- return dt;
+ GetDateFormatA(LOCALE_NEUTRAL, 0, NULL, format, date, 9);
+
+ return date;
+
}
Modified: branches/ros-amd64-bringup/reactos/lib/sdk/crt/time/strtime.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/s…
==============================================================================
--- branches/ros-amd64-bringup/reactos/lib/sdk/crt/time/strtime.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/time/strtime.c [iso-8859-1] Sat Aug 30
22:22:13 2008
@@ -12,18 +12,11 @@
/*
* @implemented
*/
-char* _strtime(char* buf)
+char* _strtime(char* time)
{
- time_t t;
- struct tm *d;
- char* dt = (char*)buf;
+ static const char format[] = "HH':'mm':'ss";
- if ( buf == NULL ) {
- __set_errno(EINVAL);
- return NULL;
- }
- t = time(NULL);
- d = localtime(&t);
- sprintf(dt,"%d:%d:%d",d->tm_hour,d->tm_min,d->tm_sec);
- return dt;
+ GetTimeFormatA(LOCALE_NEUTRAL, 0, NULL, format, time, 9);
+
+ return time;
}
Modified: branches/ros-amd64-bringup/reactos/lib/sdk/crt/time/wstrdate.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/s…
==============================================================================
--- branches/ros-amd64-bringup/reactos/lib/sdk/crt/time/wstrdate.c [iso-8859-1]
(original)
+++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/time/wstrdate.c [iso-8859-1] Sat Aug 30
22:22:13 2008
@@ -12,18 +12,12 @@
/*
* @implemented
*/
-wchar_t* _wstrdate(wchar_t* datestr)
+wchar_t* _wstrdate(wchar_t* date)
{
- time_t t;
- struct tm* d;
- wchar_t* dt = (wchar_t*)datestr;
+ static const WCHAR format[] = {
'M','M','\'','/','\'','d','d','\'','/','\'','y','y',0
};
- if (datestr == NULL) {
- __set_errno(EINVAL);
- return NULL;
- }
- t = time(NULL);
- d = localtime(&t);
- swprintf(dt,L"%d/%d/%d",d->tm_mday,d->tm_mon+1,d->tm_year);
- return dt;
+ GetDateFormatW(LOCALE_NEUTRAL, 0, NULL, format, (LPWSTR)date, 9);
+
+ return date;
+
}
Modified: branches/ros-amd64-bringup/reactos/lib/sdk/crt/time/wstrtime.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/s…
==============================================================================
--- branches/ros-amd64-bringup/reactos/lib/sdk/crt/time/wstrtime.c [iso-8859-1]
(original)
+++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/time/wstrtime.c [iso-8859-1] Sat Aug 30
22:22:13 2008
@@ -12,18 +12,11 @@
/*
* @implemented
*/
-wchar_t* _wstrtime(wchar_t* buf)
+wchar_t* _wstrtime(wchar_t* time)
{
- time_t t;
- struct tm* d;
- wchar_t* dt = (wchar_t*)buf;
+ static const WCHAR format[] = {
'H','H','\'',':','\'','m','m','\'',':','\'','s','s',0
};
- if ( buf == NULL ) {
- __set_errno(EINVAL);
- return NULL;
- }
- t = time(NULL);
- d = localtime(&t);
- swprintf(dt,L"%d:%d:%d",d->tm_hour,d->tm_min,d->tm_sec);
- return dt;
+ GetTimeFormatW(LOCALE_NEUTRAL, 0, NULL, format, (LPWSTR)time, 9);
+
+ return time;
}