Added _wasctime() and _wctime().

svn path=/trunk/; revision=2047
This commit is contained in:
Eric Kohl 2001-07-06 21:17:36 +00:00
parent 4eca28a7a6
commit af1605f6f6
3 changed files with 36 additions and 6 deletions

View file

@ -18,9 +18,9 @@
* DISCLAMED. This includes but is not limited to warranties of * DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Revision: 1.2 $ * $Revision: 1.3 $
* $Author: ekohl $ * $Author: ekohl $
* $Date: 2001/07/06 12:50:47 $ * $Date: 2001/07/06 21:16:28 $
* *
*/ */
/* Appropriated for Reactos Crtdll by Ariadne */ /* Appropriated for Reactos Crtdll by Ariadne */
@ -101,7 +101,9 @@ time_t mktime (struct tm* tmsp);
* a directory gives 'invalid' times in st_atime etc... * a directory gives 'invalid' times in st_atime etc...
*/ */
char* asctime (const struct tm* tmsp); char* asctime (const struct tm* tmsp);
wchar_t* _wasctime(const struct tm *timeptr);
char* ctime (const time_t* tp); char* ctime (const time_t* tp);
wchar_t* _wctime(const time_t * const timep);
struct tm* gmtime (const time_t* tm); struct tm* gmtime (const time_t* tm);
struct tm* localtime (const time_t* tm); struct tm* localtime (const time_t* tm);

View file

@ -1,4 +1,4 @@
; $Id: msvcrt.def,v 1.11 2001/07/06 12:53:03 ekohl Exp $ ; $Id: msvcrt.def,v 1.12 2001/07/06 21:17:36 ekohl Exp $
; ;
; ReactOS MSVCRT Compatibility Library ; ReactOS MSVCRT Compatibility Library
; ;
@ -468,7 +468,7 @@ _strnicoll
_strnset _strnset
_strrev _strrev
_strset _strset
; _strtime _strtime
_strupr _strupr
_swab _swab
_sys_errlist DATA _sys_errlist DATA
@ -494,7 +494,7 @@ _utime
_vsnprintf _vsnprintf
_vsnwprintf _vsnwprintf
_waccess _waccess
; _wasctime _wasctime
_wchdir _wchdir
_wchmod _wchmod
; _wcmdln ; _wcmdln
@ -510,7 +510,7 @@ _wcsnset
_wcsrev _wcsrev
_wcsset _wcsset
_wcsupr _wcsupr
; _wctime _wctime
; _wenviron ; _wenviron
; _wexecl ; _wexecl
; _wexecle ; _wexecle

View file

@ -1191,12 +1191,40 @@ asctime(const struct tm *timeptr)
return result; return result;
} }
wchar_t *
_wasctime(const struct tm *timeptr)
{
static const wchar_t wday_name[DAYSPERWEEK][3] = {
L"Sun", L"Mon", L"Tue", L"Wed", L"Thu", L"Fri", L"Sat"
};
static const wchar_t mon_name[MONSPERYEAR][3] = {
L"Jan", L"Feb", L"Mar", L"Apr", L"May", L"Jun",
L"Jul", L"Aug", L"Sep", L"Oct", L"Nov", L"Dec"
};
static wchar_t result[26];
(void)swprintf(result, L"%.3s %.3s%3d %02d:%02d:%02d %d\n",
wday_name[timeptr->tm_wday],
mon_name[timeptr->tm_mon],
timeptr->tm_mday, timeptr->tm_hour,
timeptr->tm_min, timeptr->tm_sec,
TM_YEAR_BASE + timeptr->tm_year);
return result;
}
char * char *
ctime(const time_t * const timep) ctime(const time_t * const timep)
{ {
return asctime(localtime(timep)); return asctime(localtime(timep));
} }
wchar_t *
_wctime(const time_t * const timep)
{
return _wasctime(localtime(timep));
}
/* /*
** Adapted from code provided by Robert Elz, who writes: ** Adapted from code provided by Robert Elz, who writes:
** The "best" way to do mktime I think is based on an idea of Bob ** The "best" way to do mktime I think is based on an idea of Bob