Make crt call win32 time APIs, like WINE

svn path=/branches/ros-amd64-bringup/; revision=35829
This commit is contained in:
Samuel Serapion
2008-08-31 03:22:13 +00:00
parent f6f0710efc
commit d3e4ae4056
4 changed files with 22 additions and 48 deletions
+6 -12
View File
@@ -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";
GetDateFormatA(LOCALE_NEUTRAL, 0, NULL, format, date, 9);
return date;
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;
}
+5 -12
View File
@@ -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;
}
+6 -12
View File
@@ -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 };
GetDateFormatW(LOCALE_NEUTRAL, 0, NULL, format, (LPWSTR)date, 9);
return date;
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;
}
+5 -12
View File
@@ -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;
}