1 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
2 /* This file has been modified by DJ Delorie. These modifications are
3 ** Copyright (C) 1995 DJ Delorie, 24 Kirsten Ave, Rochester NH,
8 * Copyright (c) 1987, 1989 Regents of the University of California.
11 * This code is derived from software contributed to Berkeley by
12 * Arthur David Olson of the National Cancer Institute.
14 * Redistribution and use in source and binary forms are permitted provided
15 * that: (1) source distributions retain this entire copyright notice and
16 * comment, and (2) distributions including binaries display the following
17 * acknowledgement: ``This product includes software developed by the
18 * University of California, Berkeley and its contributors'' in the
19 * documentation or other materials provided with the distribution and in
20 * all advertising materials mentioning features or use of this software.
21 * Neither the name of the University nor the names of its contributors may
22 * be used to endorse or promote products derived from this software without
23 * specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
25 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
26 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29 #include <msvcrt/fcntl.h>
30 #include <msvcrt/time.h>
38 wchar_t* _wasctime(const struct tm* timeptr)
41 static const wchar_t wday_name[DAYSPERWEEK][3] = {
42 L"Sun", L"Mon", L"Tue", L"Wed", L"Thu", L"Fri", L"Sat"
44 static const wchar_t mon_name[MONSPERYEAR][3] = {
45 L"Jan", L"Feb", L"Mar", L"Apr", L"May", L"Jun",
46 L"Jul", L"Aug", L"Sep", L"Oct", L"Nov", L"Dec"
49 static const wchar_t wday_name[DAYSPERWEEK][4] = {
50 L"Sun", L"Mon", L"Tue", L"Wed", L"Thu", L"Fri", L"Sat"
52 static const wchar_t mon_name[MONSPERYEAR][4] = {
53 L"Jan", L"Feb", L"Mar", L"Apr", L"May", L"Jun",
54 L"Jul", L"Aug", L"Sep", L"Oct", L"Nov", L"Dec"
57 static wchar_t result[26];
59 (void)swprintf(result, L"%.3s %.3s%3d %02d:%02d:%02d %d\n",
60 wday_name[timeptr->tm_wday],
61 mon_name[timeptr->tm_mon],
62 timeptr->tm_mday, timeptr->tm_hour,
63 timeptr->tm_min, timeptr->tm_sec,
64 TM_YEAR_BASE + timeptr->tm_year);
72 wchar_t* _wctime(const time_t* const timep)
74 return _wasctime(localtime(timep));