From af1605f6f6ea45d9dd15ffe3c915f629f0bbd2c6 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Fri, 6 Jul 2001 21:17:36 +0000 Subject: [PATCH] Added _wasctime() and _wctime(). svn path=/trunk/; revision=2047 --- reactos/include/msvcrt/time.h | 6 ++++-- reactos/lib/msvcrt/msvcrt.def | 8 ++++---- reactos/lib/msvcrt/time/ctime.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/reactos/include/msvcrt/time.h b/reactos/include/msvcrt/time.h index bc432138126..498e59d3374 100644 --- a/reactos/include/msvcrt/time.h +++ b/reactos/include/msvcrt/time.h @@ -18,9 +18,9 @@ * DISCLAMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * $Author: ekohl $ - * $Date: 2001/07/06 12:50:47 $ + * $Date: 2001/07/06 21:16:28 $ * */ /* 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... */ char* asctime (const struct tm* tmsp); +wchar_t* _wasctime(const struct tm *timeptr); char* ctime (const time_t* tp); +wchar_t* _wctime(const time_t * const timep); struct tm* gmtime (const time_t* tm); struct tm* localtime (const time_t* tm); diff --git a/reactos/lib/msvcrt/msvcrt.def b/reactos/lib/msvcrt/msvcrt.def index 1fde05e97f2..da91275c89f 100644 --- a/reactos/lib/msvcrt/msvcrt.def +++ b/reactos/lib/msvcrt/msvcrt.def @@ -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 ; @@ -468,7 +468,7 @@ _strnicoll _strnset _strrev _strset -; _strtime +_strtime _strupr _swab _sys_errlist DATA @@ -494,7 +494,7 @@ _utime _vsnprintf _vsnwprintf _waccess -; _wasctime +_wasctime _wchdir _wchmod ; _wcmdln @@ -510,7 +510,7 @@ _wcsnset _wcsrev _wcsset _wcsupr -; _wctime +_wctime ; _wenviron ; _wexecl ; _wexecle diff --git a/reactos/lib/msvcrt/time/ctime.c b/reactos/lib/msvcrt/time/ctime.c index 597b867f674..40cf9ed6375 100644 --- a/reactos/lib/msvcrt/time/ctime.c +++ b/reactos/lib/msvcrt/time/ctime.c @@ -1191,12 +1191,40 @@ asctime(const struct tm *timeptr) 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 * ctime(const time_t * const 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: ** The "best" way to do mktime I think is based on an idea of Bob