Added _wasctime() and _wctime().
authorEric Kohl <eric.kohl@reactos.org>
Fri, 6 Jul 2001 21:17:36 +0000 (21:17 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Fri, 6 Jul 2001 21:17:36 +0000 (21:17 +0000)
svn path=/trunk/; revision=2047

reactos/include/msvcrt/time.h
reactos/lib/msvcrt/msvcrt.def
reactos/lib/msvcrt/time/ctime.c

index bc43213..498e59d 100644 (file)
@@ -18,9 +18,9 @@
  *  DISCLAMED. This includes but is not limited to warranties of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  *
  *  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 $
  * $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...
  */
 char*          asctime (const 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);
 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);
 
 struct tm*     gmtime (const time_t* tm);
 struct tm*     localtime (const time_t* tm);
 
index 1fde05e..da91275 100644 (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
 _strrev
 _strset
 _strnset
 _strrev
 _strset
-_strtime
+_strtime
 _strupr
 _swab
 _sys_errlist DATA
 _strupr
 _swab
 _sys_errlist DATA
@@ -494,7 +494,7 @@ _utime
 _vsnprintf
 _vsnwprintf
 _waccess
 _vsnprintf
 _vsnwprintf
 _waccess
-_wasctime
+_wasctime
 _wchdir
 _wchmod
 ; _wcmdln
 _wchdir
 _wchmod
 ; _wcmdln
@@ -510,7 +510,7 @@ _wcsnset
 _wcsrev
 _wcsset
 _wcsupr
 _wcsrev
 _wcsset
 _wcsupr
-_wctime
+_wctime
 ; _wenviron
 ; _wexecl
 ; _wexecle
 ; _wenviron
 ; _wexecl
 ; _wexecle
index 597b867..40cf9ed 100644 (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 *
 ctime(const time_t * const timep)
 {
   return asctime(localtime(timep));
 }
 
 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
 /*
 ** Adapted from code provided by Robert Elz, who writes:
 **     The "best" way to do mktime I think is based on an idea of Bob