mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 18:35:41 +00:00
Switch from time to time_new 1/2:
-Get updated headers into place, prepare rbuild file, delete old dir svn path=/trunk/; revision=42422
This commit is contained in:
parent
c2b61c7b42
commit
bb36c210f0
19 changed files with 90 additions and 2437 deletions
|
@ -429,18 +429,46 @@
|
||||||
<file>systime.c</file>
|
<file>systime.c</file>
|
||||||
</directory>
|
</directory>
|
||||||
<directory name="time">
|
<directory name="time">
|
||||||
|
<file>asctime.c</file>
|
||||||
<file>clock.c</file>
|
<file>clock.c</file>
|
||||||
|
<file>ctime32.c</file>
|
||||||
|
<file>ctime64.c</file>
|
||||||
<file>ctime.c</file>
|
<file>ctime.c</file>
|
||||||
|
<file>difftime32.c</file>
|
||||||
|
<file>difftime64.c</file>
|
||||||
<file>difftime.c</file>
|
<file>difftime.c</file>
|
||||||
|
<file>ftime32.c</file>
|
||||||
|
<file>ftime64.c</file>
|
||||||
<file>ftime.c</file>
|
<file>ftime.c</file>
|
||||||
|
<file>futime32.c</file>
|
||||||
|
<file>futime64.c</file>
|
||||||
|
<file>futime.c</file>
|
||||||
|
<file>gmtime.c</file>
|
||||||
|
<file>localtime32.c</file>
|
||||||
|
<file>localtime64.c</file>
|
||||||
|
<file>localtime.c</file>
|
||||||
|
<file>mktime.c</file>
|
||||||
<file>strdate.c</file>
|
<file>strdate.c</file>
|
||||||
<file>strftime.c</file>
|
<file>strftime.c</file>
|
||||||
<file>strtime.c</file>
|
<file>strtime.c</file>
|
||||||
|
<file>time32.c</file>
|
||||||
|
<file>time64.c</file>
|
||||||
<file>time.c</file>
|
<file>time.c</file>
|
||||||
<file>tz_vars.c</file>
|
<file>timezone.c</file>
|
||||||
|
<file>tzname.c</file>
|
||||||
|
<file>utime32.c</file>
|
||||||
|
<file>utime64.c</file>
|
||||||
|
<file>utime.c</file>
|
||||||
|
<file>wasctime.c</file>
|
||||||
|
<file>wcsftime.c</file>
|
||||||
|
<file>wctime32.c</file>
|
||||||
|
<file>wctime64.c</file>
|
||||||
<file>wctime.c</file>
|
<file>wctime.c</file>
|
||||||
<file>wstrdate.c</file>
|
<file>wstrdate.c</file>
|
||||||
<file>wstrtime.c</file>
|
<file>wstrtime.c</file>
|
||||||
|
<file>wutime32.c</file>
|
||||||
|
<file>wutime64.c</file>
|
||||||
|
<file>wutime.c</file>
|
||||||
</directory>
|
</directory>
|
||||||
<directory name="wstring">
|
<directory name="wstring">
|
||||||
<file>wcscoll.c</file>
|
<file>wcscoll.c</file>
|
||||||
|
|
|
@ -49,8 +49,6 @@ int __fileno_setmode(int _fd, int _newmode);
|
||||||
void sigabort_handler(int sig);
|
void sigabort_handler(int sig);
|
||||||
|
|
||||||
void UnixTimeToFileTime(time_t unix_time, FILETIME* filetime, DWORD remainder);
|
void UnixTimeToFileTime(time_t unix_time, FILETIME* filetime, DWORD remainder);
|
||||||
time_t FileTimeToUnixTime(const FILETIME* filetime, DWORD *remainder);
|
|
||||||
|
|
||||||
|
|
||||||
#define __FILE_REC_MAX 20
|
#define __FILE_REC_MAX 20
|
||||||
typedef struct __file_rec
|
typedef struct __file_rec
|
||||||
|
|
55
reactos/lib/sdk/crt/include/internal/time.h
Normal file
55
reactos/lib/sdk/crt/include/internal/time.h
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
#define DIFFTIME 0x19db1ded53e8000ULL
|
||||||
|
#define DIFFDAYS (3 * DAYSPER100YEARS + 17 * DAYSPER4YEARS + 1 * DAYSPERYEAR)
|
||||||
|
|
||||||
|
#define DAYSPERYEAR 365
|
||||||
|
#define DAYSPER4YEARS (4*DAYSPERYEAR+1)
|
||||||
|
#define DAYSPER100YEARS (25*DAYSPER4YEARS-1)
|
||||||
|
#define DAYSPER400YEARS (4*DAYSPER100YEARS+1)
|
||||||
|
#define SECONDSPERDAY (24*60*60)
|
||||||
|
#define SECONDSPERHOUR (60*60)
|
||||||
|
#define LEAPDAY 59
|
||||||
|
|
||||||
|
static __inline
|
||||||
|
__time64_t
|
||||||
|
FileTimeToUnixTime(const FILETIME *FileTime, USHORT *millitm)
|
||||||
|
{
|
||||||
|
ULARGE_INTEGER ULargeInt;
|
||||||
|
__time64_t time;
|
||||||
|
|
||||||
|
ULargeInt.LowPart = FileTime->dwLowDateTime;
|
||||||
|
ULargeInt.HighPart = FileTime->dwHighDateTime;
|
||||||
|
ULargeInt.QuadPart -= DIFFTIME;
|
||||||
|
|
||||||
|
time = ULargeInt.QuadPart / 10000;
|
||||||
|
if (millitm)
|
||||||
|
*millitm = (ULargeInt.QuadPart % 10000) / 10;
|
||||||
|
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline
|
||||||
|
long leapyears_passed(long days)
|
||||||
|
{
|
||||||
|
long quadcenturies, centuries, quadyears;
|
||||||
|
quadcenturies = days / DAYSPER400YEARS;
|
||||||
|
days -= quadcenturies;
|
||||||
|
centuries = days / DAYSPER100YEARS;
|
||||||
|
days += centuries;
|
||||||
|
quadyears = days / DAYSPER4YEARS;
|
||||||
|
return quadyears - centuries + quadcenturies;
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline
|
||||||
|
long leapdays_passed(long days)
|
||||||
|
{
|
||||||
|
return leapyears_passed(days + DAYSPERYEAR - LEAPDAY + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline
|
||||||
|
long years_passed(long days)
|
||||||
|
{
|
||||||
|
return (days - leapdays_passed(days)) / 365;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern long dst_begin;
|
||||||
|
extern long dst_end;
|
|
@ -12,6 +12,7 @@
|
||||||
#include <windef.h>
|
#include <windef.h>
|
||||||
#include <winbase.h>
|
#include <winbase.h>
|
||||||
#include <winnt.h>
|
#include <winnt.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
@ -29,6 +30,10 @@ typedef struct _ThreadData
|
||||||
|
|
||||||
EXCEPTION_RECORD *exc_record; /* Head of exception record list */
|
EXCEPTION_RECORD *exc_record; /* Head of exception record list */
|
||||||
|
|
||||||
|
struct tm tmbuf; /* Used by gmtime, mktime, mkgmtime, localtime */
|
||||||
|
char asctimebuf[26]; /* Buffer for asctime and ctime */
|
||||||
|
wchar_t wasctimebuf[26]; /* Buffer for wasctime and wctime */
|
||||||
|
|
||||||
} THREADDATA, *PTHREADDATA;
|
} THREADDATA, *PTHREADDATA;
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,4 +46,3 @@ PTHREADDATA GetThreadData(void);
|
||||||
#endif /* __MSVCRT_INTERNAL_TLS_H */
|
#endif /* __MSVCRT_INTERNAL_TLS_H */
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
|
||||||
#include <internal/mbstring.h>
|
#include <internal/mbstring.h>
|
||||||
#include <internal/mtdll.h>
|
#include <internal/mtdll.h>
|
||||||
#include <internal/rterror.h>
|
#include <internal/rterror.h>
|
||||||
|
#include <internal/time.h>
|
||||||
#include <internal/tls.h>
|
#include <internal/tls.h>
|
||||||
#include <internal/printf.h>
|
#include <internal/printf.h>
|
||||||
|
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
/*
|
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
|
||||||
* PROJECT: ReactOS system libraries
|
|
||||||
* FILE: lib/msvcrt/time/clock.c
|
|
||||||
* PURPOSE: Get elapsed time
|
|
||||||
* PROGRAMER: Ariadne
|
|
||||||
* UPDATE HISTORY:
|
|
||||||
* 28/12/98: Created
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <precomp.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
clock_t clock ( void )
|
|
||||||
{
|
|
||||||
FILETIME CreationTime;
|
|
||||||
FILETIME ExitTime;
|
|
||||||
FILETIME KernelTime;
|
|
||||||
FILETIME UserTime;
|
|
||||||
DWORD Remainder;
|
|
||||||
|
|
||||||
if (!GetProcessTimes(GetCurrentProcess(),&CreationTime,&ExitTime,&KernelTime,&UserTime))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return FileTimeToUnixTime(&KernelTime,&Remainder) + FileTimeToUnixTime(&UserTime,&Remainder);
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,11 +0,0 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
#include <precomp.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
double
|
|
||||||
difftime(time_t time1, time_t time2)
|
|
||||||
{
|
|
||||||
return (double)(time1 - time2);
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
/*
|
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
|
||||||
* PROJECT: ReactOS system libraries
|
|
||||||
* FILE: lib/msvcrt/time/ftime.c
|
|
||||||
* PURPOSE: Deprecated BSD library call
|
|
||||||
* PROGRAMER: Art Yerkes
|
|
||||||
* UPDATE HISTORY:
|
|
||||||
* 07/15/03 -- Created
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <precomp.h>
|
|
||||||
#include <sys/timeb.h>
|
|
||||||
|
|
||||||
/* ftime (3) -- Obsolete BSD library function included in the SUS for copat.
|
|
||||||
* Also present in msvcrt.dll as _ftime
|
|
||||||
* See: http://www.opengroup.org/onlinepubs/007904957/functions/ftime.html */
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
#undef _ftime
|
|
||||||
void _ftime( struct _timeb *tm )
|
|
||||||
{
|
|
||||||
int ret = 0;
|
|
||||||
SYSTEMTIME syst;
|
|
||||||
|
|
||||||
GetSystemTime( &syst );
|
|
||||||
|
|
||||||
if( ret == 0 ) {
|
|
||||||
time( &tm->time );
|
|
||||||
tm->millitm = syst.wMilliseconds;
|
|
||||||
// tm->_timezone = 0; /* According to the open group, timezone and dstflag */
|
|
||||||
tm->dstflag = 0; /* exist for compatibility, but are unspecified. */
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,49 +0,0 @@
|
||||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
/* generated with bin2h from DJGPP/zoneinfo/posixrules */
|
|
||||||
|
|
||||||
unsigned char _posixrules_data[] = {
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,
|
|
||||||
0,1,16,0,0,0,2,0,0,0,8,0,151,254,240,1,135,225,224,2,119,224,240,3,112,254,96,4,96,253,112,5,80,
|
|
||||||
224,96,6,64,223,112,7,48,194,96,7,141,25,112,9,16,164,96,9,173,148,240,10,240,134,96,11,224,133,112,12,217,162,
|
|
||||||
224,13,192,103,112,14,185,132,224,15,169,131,240,16,153,102,224,17,137,101,240,18,121,72,224,19,105,71,240,20,89,42,224,
|
|
||||||
21,73,41,240,22,57,12,224,23,41,11,240,24,34,41,96,25,8,237,240,26,2,11,96,26,242,10,112,27,225,237,96,28,
|
|
||||||
209,236,112,29,193,207,96,30,177,206,112,31,161,177,96,32,118,0,240,33,129,147,96,34,85,226,240,35,106,175,224,36,53,
|
|
||||||
196,240,37,74,145,224,38,21,166,240,39,42,115,224,39,254,195,112,41,10,85,224,41,222,165,112,42,234,55,224,43,190,135,
|
|
||||||
112,44,211,84,96,45,158,105,112,46,179,54,96,47,126,75,112,48,147,24,96,49,103,103,240,50,114,250,96,51,71,73,240,
|
|
||||||
52,82,220,96,53,39,43,240,54,50,190,96,55,7,13,240,56,27,218,224,56,230,239,240,57,251,188,224,58,198,209,240,59,
|
|
||||||
219,158,224,60,175,238,112,61,187,128,224,62,143,208,112,63,155,98,224,64,111,178,112,65,132,127,96,66,79,148,112,67,100,
|
|
||||||
97,96,68,47,118,112,69,68,67,96,70,15,88,112,71,36,37,96,71,248,116,240,73,4,7,96,73,216,86,240,74,227,233,
|
|
||||||
96,75,184,56,240,76,205,5,224,77,152,26,240,78,172,231,224,79,119,252,240,80,140,201,224,81,97,25,112,82,108,171,224,
|
|
||||||
83,64,251,112,84,76,141,224,85,32,221,112,86,44,111,224,87,0,191,112,88,21,140,96,88,224,161,112,89,245,110,96,90,
|
|
||||||
192,131,112,91,213,80,96,92,169,159,240,93,181,50,96,94,137,129,240,95,149,20,96,96,105,99,240,97,126,48,224,98,73,
|
|
||||||
69,240,99,94,18,224,100,41,39,240,101,61,244,224,102,18,68,112,103,29,214,224,103,242,38,112,104,253,184,224,105,210,8,
|
|
||||||
112,106,221,154,224,107,177,234,112,108,198,183,96,109,145,204,112,110,166,153,96,111,113,174,112,112,134,123,96,113,90,202,240,
|
|
||||||
114,102,93,96,115,58,172,240,116,70,63,96,117,26,142,240,118,47,91,224,118,250,112,240,120,15,61,224,120,218,82,240,121,
|
|
||||||
239,31,224,122,186,52,240,123,207,1,224,124,163,81,112,125,174,227,224,126,131,51,112,127,142,197,224,128,99,21,112,129,119,
|
|
||||||
226,96,130,66,247,112,131,87,196,96,132,34,217,112,133,55,166,96,134,11,245,240,135,23,136,96,135,235,215,240,136,247,106,
|
|
||||||
96,137,203,185,240,138,215,76,96,139,171,155,240,140,192,104,224,141,139,125,240,142,160,74,224,143,107,95,240,144,128,44,224,
|
|
||||||
145,84,124,112,146,96,14,224,147,52,94,112,148,63,240,224,149,20,64,112,150,41,13,96,150,244,34,112,152,8,239,96,152,
|
|
||||||
212,4,112,153,232,209,96,154,189,32,240,155,200,179,96,156,157,2,240,157,168,149,96,158,124,228,240,159,136,119,96,160,92,
|
|
||||||
198,240,161,113,147,224,162,60,168,240,163,81,117,224,164,28,138,240,165,49,87,224,166,5,167,112,167,17,57,224,167,229,137,
|
|
||||||
112,168,241,27,224,169,197,107,112,170,218,56,96,171,165,77,112,172,186,26,96,173,133,47,112,174,153,252,96,175,101,17,112,
|
|
||||||
176,121,222,96,177,78,45,240,178,89,192,96,179,46,15,240,180,57,162,96,181,13,241,240,182,34,190,224,182,237,211,240,184,
|
|
||||||
2,160,224,184,205,181,240,185,226,130,224,186,182,210,112,187,194,100,224,188,150,180,112,189,162,70,224,190,118,150,112,191,130,
|
|
||||||
40,224,192,86,120,112,193,107,69,96,194,54,90,112,195,75,39,96,196,22,60,112,197,43,9,96,197,255,88,240,199,10,235,
|
|
||||||
96,199,223,58,240,200,234,205,96,201,191,28,240,202,211,233,224,203,158,254,240,204,179,203,224,205,126,224,240,206,147,173,224,
|
|
||||||
207,103,253,112,208,115,143,224,209,71,223,112,210,83,113,224,211,39,193,112,212,51,83,224,213,7,163,112,214,28,112,96,214,
|
|
||||||
231,133,112,215,252,82,96,216,199,103,112,217,220,52,96,218,176,131,240,219,188,22,96,220,144,101,240,221,155,248,96,222,112,
|
|
||||||
71,240,223,133,20,224,224,80,41,240,225,100,246,224,226,48,11,240,227,68,216,224,228,15,237,240,229,36,186,224,229,249,10,
|
|
||||||
112,231,4,156,224,231,216,236,112,232,228,126,224,233,184,206,112,234,205,155,96,235,152,176,112,236,173,125,96,237,120,146,112,
|
|
||||||
238,141,95,96,239,97,174,240,240,109,65,96,241,65,144,240,242,77,35,96,243,33,114,240,244,45,5,96,245,1,84,240,246,
|
|
||||||
22,33,224,246,225,54,240,247,246,3,224,248,193,24,240,249,213,229,224,250,160,250,240,251,181,199,224,252,138,23,112,253,149,
|
|
||||||
169,224,254,105,249,112,255,117,139,224,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
|
|
||||||
1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,
|
|
||||||
0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
|
|
||||||
1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,
|
|
||||||
0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
|
|
||||||
1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,
|
|
||||||
0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
|
|
||||||
1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,
|
|
||||||
0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,255,255,199,192,1,0,255,255,185,176,0,4,69,68,84,
|
|
||||||
0,69,83,84,0,0,0
|
|
||||||
};
|
|
|
@ -1,23 +0,0 @@
|
||||||
/*
|
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
|
||||||
* PROJECT: ReactOS system libraries
|
|
||||||
* FILE: lib/msvcrt/time/strtime.c
|
|
||||||
* PURPOSE: Fills a buffer with a formatted date representation
|
|
||||||
* PROGRAMER: Ariadne
|
|
||||||
* UPDATE HISTORY:
|
|
||||||
* 28/12/98: Created
|
|
||||||
*/
|
|
||||||
#include <precomp.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
char* _strdate(char* date)
|
|
||||||
{
|
|
||||||
static const char format[] = "MM'/'dd'/'yy";
|
|
||||||
|
|
||||||
GetDateFormatA(LOCALE_NEUTRAL, 0, NULL, format, date, 9);
|
|
||||||
|
|
||||||
return date;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,260 +0,0 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
|
|
||||||
#include <precomp.h>
|
|
||||||
|
|
||||||
#define TM_YEAR_BASE 1900
|
|
||||||
|
|
||||||
static const char *afmt[] = {
|
|
||||||
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
|
|
||||||
};
|
|
||||||
static const char *Afmt[] = {
|
|
||||||
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
|
|
||||||
"Saturday",
|
|
||||||
};
|
|
||||||
static const char *bfmt[] = {
|
|
||||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
|
|
||||||
"Oct", "Nov", "Dec",
|
|
||||||
};
|
|
||||||
static const char *Bfmt[] = {
|
|
||||||
"January", "February", "March", "April", "May", "June", "July",
|
|
||||||
"August", "September", "October", "November", "December",
|
|
||||||
};
|
|
||||||
|
|
||||||
static size_t gsize;
|
|
||||||
static char *pt;
|
|
||||||
|
|
||||||
|
|
||||||
static int _add(const char* str)
|
|
||||||
{
|
|
||||||
for (;; ++pt, --gsize)
|
|
||||||
{
|
|
||||||
if (!gsize)
|
|
||||||
return 0;
|
|
||||||
if (!(*pt = *str++))
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _conv(int n, int digits, char pad)
|
|
||||||
{
|
|
||||||
static char buf[10];
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
for (p = buf + sizeof(buf) - 2; n > 0 && p > buf; n /= 10, --digits)
|
|
||||||
*p-- = n % 10 + '0';
|
|
||||||
while (p > buf && digits-- > 0)
|
|
||||||
*p-- = pad;
|
|
||||||
return _add(++p);
|
|
||||||
}
|
|
||||||
|
|
||||||
static size_t _fmt(const char* format, const struct tm* t)
|
|
||||||
{
|
|
||||||
for (; *format; ++format)
|
|
||||||
{
|
|
||||||
if (*format == '%') {
|
|
||||||
if (*(format+1) == '#' ) {format++;}
|
|
||||||
|
|
||||||
switch(*++format) {
|
|
||||||
case '\0':
|
|
||||||
--format;
|
|
||||||
break;
|
|
||||||
case 'A':
|
|
||||||
if (t->tm_wday < 0 || t->tm_wday > 6)
|
|
||||||
return 0;
|
|
||||||
if (!_add(Afmt[t->tm_wday]))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'a':
|
|
||||||
if (t->tm_wday < 0 || t->tm_wday > 6)
|
|
||||||
return 0;
|
|
||||||
if (!_add(afmt[t->tm_wday]))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'B':
|
|
||||||
if (t->tm_mon < 0 || t->tm_mon > 11)
|
|
||||||
return 0;
|
|
||||||
if (!_add(Bfmt[t->tm_mon]))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'b':
|
|
||||||
case 'h':
|
|
||||||
if (t->tm_mon < 0 || t->tm_mon > 11)
|
|
||||||
return 0;
|
|
||||||
if (!_add(bfmt[t->tm_mon]))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'C':
|
|
||||||
if (!_fmt("%a %b %e %H:%M:%S %Y", t))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'c':
|
|
||||||
if (!_fmt("%m/%d/%y %H:%M:%S", t))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'e':
|
|
||||||
if (!_conv(t->tm_mday, 2, ' '))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'D':
|
|
||||||
if (!_fmt("%m/%d/%y", t))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'd':
|
|
||||||
if (!_conv(t->tm_mday, 2, '0'))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'H':
|
|
||||||
if (!_conv(t->tm_hour, 2, '0'))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'I':
|
|
||||||
if (!_conv(t->tm_hour % 12 ? t->tm_hour % 12 : 12, 2, '0'))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'j':
|
|
||||||
if (!_conv(t->tm_yday + 1, 3, '0'))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'k':
|
|
||||||
if (!_conv(t->tm_hour, 2, ' '))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'l':
|
|
||||||
if (!_conv(t->tm_hour % 12 ? t->tm_hour % 12 : 12, 2, ' '))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'M':
|
|
||||||
if (!_conv(t->tm_min, 2, '0'))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'm':
|
|
||||||
if (!_conv(t->tm_mon + 1, 2, '0'))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'n':
|
|
||||||
if (!_add("\n"))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'p':
|
|
||||||
if (!_add(t->tm_hour >= 12 ? "PM" : "AM"))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'R':
|
|
||||||
if (!_fmt("%H:%M", t))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'r':
|
|
||||||
if (!_fmt("%I:%M:%S %p", t))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'S':
|
|
||||||
if (!_conv(t->tm_sec, 2, '0'))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'T':
|
|
||||||
case 'X':
|
|
||||||
if (!_fmt("%H:%M:%S", t))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 't':
|
|
||||||
if (!_add("\t"))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'U':
|
|
||||||
if (!_conv((t->tm_yday + 7 - t->tm_wday) / 7, 2, '0'))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'W':
|
|
||||||
if (!_conv((t->tm_yday + 7 - (t->tm_wday ? (t->tm_wday - 1) : 6)) / 7, 2, '0'))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'w':
|
|
||||||
if (!_conv(t->tm_wday, 1, '0'))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'x':
|
|
||||||
if (!_fmt("%m/%d/%y", t))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'y':
|
|
||||||
if (!_conv((t->tm_year + TM_YEAR_BASE) % 100, 2, '0'))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'Y':
|
|
||||||
if (!_conv(t->tm_year + TM_YEAR_BASE, 4, '0'))
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case 'Z':
|
|
||||||
#if 0
|
|
||||||
/* FIXME: tm_zone doesnt exist in windows */
|
|
||||||
if (!t->tm_zone || !_add(t->tm_zone))
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
continue;
|
|
||||||
case '%':
|
|
||||||
/*
|
|
||||||
* X311J/88-090 (4.12.3.5): if conversion char is
|
|
||||||
* undefined, behavior is undefined. Print out the
|
|
||||||
* character itself as printf(3) does.
|
|
||||||
*/
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!gsize--)
|
|
||||||
return 0;
|
|
||||||
*pt++ = *format;
|
|
||||||
}
|
|
||||||
return gsize;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
size_t
|
|
||||||
strftime(char *s, size_t maxsize, const char *format, const struct tm *t)
|
|
||||||
{
|
|
||||||
pt = s;
|
|
||||||
if ((gsize = maxsize) < 1)
|
|
||||||
return 0;
|
|
||||||
if (_fmt(format, t))
|
|
||||||
{
|
|
||||||
*pt = '\0';
|
|
||||||
return maxsize - gsize;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
size_t wcsftime(wchar_t* s, size_t maxsize, const wchar_t* format, const struct tm* t)
|
|
||||||
{
|
|
||||||
char *x;
|
|
||||||
char *f;
|
|
||||||
size_t i,j;
|
|
||||||
if ((gsize = maxsize) < 1)
|
|
||||||
return 0;
|
|
||||||
x = malloc(maxsize);
|
|
||||||
j = wcslen(format);
|
|
||||||
f = malloc(j+1);
|
|
||||||
for(i=0;i<j;i++)
|
|
||||||
f[i] = (char)*format;
|
|
||||||
f[i] = 0;
|
|
||||||
pt = x;
|
|
||||||
if (_fmt(f, t)) {
|
|
||||||
*pt = '\0';
|
|
||||||
free(f);
|
|
||||||
for(i=0;i<maxsize;i++)
|
|
||||||
s[i] = (wchar_t)x[i];
|
|
||||||
s[i] = 0;
|
|
||||||
free(x);
|
|
||||||
return maxsize - gsize;
|
|
||||||
}
|
|
||||||
for(i=0;i<maxsize;i++)
|
|
||||||
s[i] = (wchar_t)x[i];
|
|
||||||
s[i] = 0;
|
|
||||||
free(f);
|
|
||||||
free(x);
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
/*
|
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
|
||||||
* PROJECT: ReactOS system libraries
|
|
||||||
* FILE: lib/msvcrt/time/strtime.c
|
|
||||||
* PURPOSE: Fills a buffer with a formatted time representation
|
|
||||||
* PROGRAMER: Ariadne
|
|
||||||
* UPDATE HISTORY:
|
|
||||||
* 28/12/98: Created
|
|
||||||
*/
|
|
||||||
#include <precomp.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
char* _strtime(char* time)
|
|
||||||
{
|
|
||||||
static const char format[] = "HH':'mm':'ss";
|
|
||||||
|
|
||||||
GetTimeFormatA(LOCALE_NEUTRAL, 0, NULL, format, time, 9);
|
|
||||||
|
|
||||||
return time;
|
|
||||||
}
|
|
|
@ -1,222 +0,0 @@
|
||||||
/*
|
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
|
||||||
* PROJECT: ReactOS system libraries
|
|
||||||
* FILE: lib/msvcrt/time/time.c
|
|
||||||
* PURPOSE: Get system time
|
|
||||||
* PROGRAMER: Ariadne
|
|
||||||
* UPDATE HISTORY:
|
|
||||||
* 28/12/98: Created
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* DOS file system functions
|
|
||||||
*
|
|
||||||
* Copyright 1993 Erik Bos
|
|
||||||
* Copyright 1996 Alexandre Julliard
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <precomp.h>
|
|
||||||
|
|
||||||
VOID WINAPI GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
time_t time(time_t* t)
|
|
||||||
{
|
|
||||||
FILETIME SystemTime;
|
|
||||||
DWORD Remainder;
|
|
||||||
time_t tt;
|
|
||||||
GetSystemTimeAsFileTime(&SystemTime);
|
|
||||||
tt = FileTimeToUnixTime(&SystemTime,&Remainder);
|
|
||||||
if (t)
|
|
||||||
*t = tt;
|
|
||||||
return tt;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* DOSFS_UnixTimeToFileTime
|
|
||||||
*
|
|
||||||
* Convert a Unix time to FILETIME format.
|
|
||||||
* The FILETIME structure is a 64-bit value representing the number of
|
|
||||||
* 100-nanosecond intervals since January 1, 1601, 0:00.
|
|
||||||
* 'remainder' is the nonnegative number of 100-ns intervals
|
|
||||||
* corresponding to the time fraction smaller than 1 second that
|
|
||||||
* couldn't be stored in the time_t value.
|
|
||||||
*/
|
|
||||||
void UnixTimeToFileTime( time_t unix_time, FILETIME *filetime,
|
|
||||||
DWORD remainder )
|
|
||||||
{
|
|
||||||
/* NOTES:
|
|
||||||
|
|
||||||
CONSTANTS:
|
|
||||||
The time difference between 1 January 1601, 00:00:00 and
|
|
||||||
1 January 1970, 00:00:00 is 369 years, plus the leap years
|
|
||||||
from 1604 to 1968, excluding 1700, 1800, 1900.
|
|
||||||
This makes (1968 - 1600) / 4 - 3 = 89 leap days, and a total
|
|
||||||
of 134774 days.
|
|
||||||
|
|
||||||
Any day in that period had 24 * 60 * 60 = 86400 seconds.
|
|
||||||
|
|
||||||
The time difference is 134774 * 86400 * 10000000, which can be written
|
|
||||||
116444736000000000
|
|
||||||
27111902 * 2^32 + 3577643008
|
|
||||||
413 * 2^48 + 45534 * 2^32 + 54590 * 2^16 + 32768
|
|
||||||
|
|
||||||
If you find that these constants are buggy, please change them in all
|
|
||||||
instances in both conversion functions.
|
|
||||||
|
|
||||||
VERSIONS:
|
|
||||||
There are two versions, one of them uses long long variables and
|
|
||||||
is presumably faster but not ISO C. The other one uses standard C
|
|
||||||
data types and operations but relies on the assumption that negative
|
|
||||||
numbers are stored as 2's complement (-1 is 0xffff....). If this
|
|
||||||
assumption is violated, dates before 1970 will not convert correctly.
|
|
||||||
This should however work on any reasonable architecture where WINE
|
|
||||||
will run.
|
|
||||||
|
|
||||||
DETAILS:
|
|
||||||
|
|
||||||
Take care not to remove the casts. I have tested these functions
|
|
||||||
(in both versions) for a lot of numbers. I would be interested in
|
|
||||||
results on other compilers than GCC.
|
|
||||||
|
|
||||||
The operations have been designed to account for the possibility
|
|
||||||
of 64-bit time_t in future UNICES. Even the versions without
|
|
||||||
internal long long numbers will work if time_t only is 64 bit.
|
|
||||||
A 32-bit shift, which was necessary for that operation, turned out
|
|
||||||
not to work correctly in GCC, besides giving the warning. So I
|
|
||||||
used a double 16-bit shift instead. Numbers are in the ISO version
|
|
||||||
represented by three limbs, the most significant with 32 bit, the
|
|
||||||
other two with 16 bit each.
|
|
||||||
|
|
||||||
As the modulo-operator % is not well-defined for negative numbers,
|
|
||||||
negative divisors have been avoided in DOSFS_FileTimeToUnixTime.
|
|
||||||
|
|
||||||
There might be quicker ways to do this in C. Certainly so in
|
|
||||||
assembler.
|
|
||||||
|
|
||||||
Claus Fischer, fischer@iue.tuwien.ac.at
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
unsigned long a0; /* 16 bit, low bits */
|
|
||||||
unsigned long a1; /* 16 bit, medium bits */
|
|
||||||
unsigned long a2; /* 32 bit, high bits */
|
|
||||||
|
|
||||||
/* Copy the unix time to a2/a1/a0 */
|
|
||||||
a0 = unix_time & 0xffff;
|
|
||||||
a1 = (unix_time >> 16) & 0xffff;
|
|
||||||
/* This is obsolete if unix_time is only 32 bits, but it does not hurt.
|
|
||||||
Do not replace this by >> 32, it gives a compiler warning and it does
|
|
||||||
not work. */
|
|
||||||
a2 = (unix_time >= 0 ? (unix_time >> 16) >> 16 :
|
|
||||||
~((~unix_time >> 16) >> 16));
|
|
||||||
|
|
||||||
/* Multiply a by 10000000 (a = a2/a1/a0)
|
|
||||||
Split the factor into 10000 * 1000 which are both less than 0xffff. */
|
|
||||||
a0 *= 10000;
|
|
||||||
a1 = a1 * 10000 + (a0 >> 16);
|
|
||||||
a2 = a2 * 10000 + (a1 >> 16);
|
|
||||||
a0 &= 0xffff;
|
|
||||||
a1 &= 0xffff;
|
|
||||||
|
|
||||||
a0 *= 1000;
|
|
||||||
a1 = a1 * 1000 + (a0 >> 16);
|
|
||||||
a2 = a2 * 1000 + (a1 >> 16);
|
|
||||||
a0 &= 0xffff;
|
|
||||||
a1 &= 0xffff;
|
|
||||||
|
|
||||||
/* Add the time difference and the remainder */
|
|
||||||
a0 += 32768 + (remainder & 0xffff);
|
|
||||||
a1 += 54590 + (remainder >> 16 ) + (a0 >> 16);
|
|
||||||
a2 += 27111902 + (a1 >> 16);
|
|
||||||
a0 &= 0xffff;
|
|
||||||
a1 &= 0xffff;
|
|
||||||
|
|
||||||
/* Set filetime */
|
|
||||||
filetime->dwLowDateTime = (a1 << 16) + a0;
|
|
||||||
filetime->dwHighDateTime = a2;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* DOSFS_FileTimeToUnixTime
|
|
||||||
*
|
|
||||||
* Convert a FILETIME format to Unix time.
|
|
||||||
* If not NULL, 'remainder' contains the fractional part of the filetime,
|
|
||||||
* in the range of [0..9999999] (even if time_t is negative).
|
|
||||||
*/
|
|
||||||
time_t FileTimeToUnixTime( const FILETIME *filetime, DWORD *remainder )
|
|
||||||
{
|
|
||||||
/* Read the comment in the function DOSFS_UnixTimeToFileTime. */
|
|
||||||
|
|
||||||
unsigned long a0; /* 16 bit, low bits */
|
|
||||||
unsigned long a1; /* 16 bit, medium bits */
|
|
||||||
unsigned long a2; /* 32 bit, high bits */
|
|
||||||
unsigned long r; /* remainder of division */
|
|
||||||
unsigned int carry; /* carry bit for subtraction */
|
|
||||||
int negative; /* whether a represents a negative value */
|
|
||||||
|
|
||||||
/* Copy the time values to a2/a1/a0 */
|
|
||||||
a2 = (unsigned long)filetime->dwHighDateTime;
|
|
||||||
a1 = ((unsigned long)filetime->dwLowDateTime ) >> 16;
|
|
||||||
a0 = ((unsigned long)filetime->dwLowDateTime ) & 0xffff;
|
|
||||||
|
|
||||||
/* Subtract the time difference */
|
|
||||||
if (a0 >= 32768 ) a0 -= 32768 , carry = 0;
|
|
||||||
else a0 += (1 << 16) - 32768 , carry = 1;
|
|
||||||
|
|
||||||
if (a1 >= 54590 + carry) a1 -= 54590 + carry, carry = 0;
|
|
||||||
else a1 += (1 << 16) - 54590 - carry, carry = 1;
|
|
||||||
|
|
||||||
a2 -= 27111902 + carry;
|
|
||||||
|
|
||||||
/* If a is negative, replace a by (-1-a) */
|
|
||||||
negative = (a2 >= ((unsigned long)1) << 31);
|
|
||||||
if (negative)
|
|
||||||
{
|
|
||||||
/* Set a to -a - 1 (a is a2/a1/a0) */
|
|
||||||
a0 = 0xffff - a0;
|
|
||||||
a1 = 0xffff - a1;
|
|
||||||
a2 = ~a2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Divide a by 10000000 (a = a2/a1/a0), put the rest into r.
|
|
||||||
Split the divisor into 10000 * 1000 which are both less than 0xffff. */
|
|
||||||
a1 += (a2 % 10000) << 16;
|
|
||||||
a2 /= 10000;
|
|
||||||
a0 += (a1 % 10000) << 16;
|
|
||||||
a1 /= 10000;
|
|
||||||
r = a0 % 10000;
|
|
||||||
a0 /= 10000;
|
|
||||||
|
|
||||||
a1 += (a2 % 1000) << 16;
|
|
||||||
a2 /= 1000;
|
|
||||||
a0 += (a1 % 1000) << 16;
|
|
||||||
a1 /= 1000;
|
|
||||||
r += (a0 % 1000) * 10000;
|
|
||||||
a0 /= 1000;
|
|
||||||
|
|
||||||
/* If a was negative, replace a by (-1-a) and r by (9999999 - r) */
|
|
||||||
if (negative)
|
|
||||||
{
|
|
||||||
/* Set a to -a - 1 (a is a2/a1/a0) */
|
|
||||||
a0 = 0xffff - a0;
|
|
||||||
a1 = 0xffff - a1;
|
|
||||||
a2 = ~a2;
|
|
||||||
|
|
||||||
r = 9999999 - r;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (remainder) *remainder = r;
|
|
||||||
|
|
||||||
/* Do not replace this by << 32, it gives a compiler warning and it does
|
|
||||||
not work. */
|
|
||||||
return ((((time_t)a2) << 16) << 16) + (a1 << 16) + a0;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
#include <string.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
|
|
||||||
int _daylight;
|
|
||||||
int _timezone;
|
|
||||||
|
|
||||||
|
|
||||||
void _set_daylight_export(int value)
|
|
||||||
{
|
|
||||||
_daylight = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _set_timezone_export(int value)
|
|
||||||
{
|
|
||||||
_timezone = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************
|
|
||||||
* __p_daylight (MSVCRT.@)
|
|
||||||
*/
|
|
||||||
void* __p__daylight(void)
|
|
||||||
{
|
|
||||||
return &_daylight;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*********************************************************************
|
|
||||||
* __p__timezone (MSVCRT.@)
|
|
||||||
*/
|
|
||||||
int* __p__timezone(void)
|
|
||||||
{
|
|
||||||
return &_timezone;
|
|
||||||
}
|
|
|
@ -1,160 +0,0 @@
|
||||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
#ifndef __dj_include_tzfile_h__
|
|
||||||
#define __dj_include_tzfile_h__
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
|
|
||||||
|
|
||||||
#ifndef __STRICT_ANSI__
|
|
||||||
|
|
||||||
#ifndef _POSIX_SOURCE
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 1988 Regents of the University of California.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This code is derived from software contributed to Berkeley by
|
|
||||||
* Arthur David Olson of the National Cancer Institute.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms are permitted provided
|
|
||||||
* that: (1) source distributions retain this entire copyright notice and
|
|
||||||
* comment, and (2) distributions including binaries display the following
|
|
||||||
* acknowledgement: ``This product includes software developed by the
|
|
||||||
* University of California, Berkeley and its contributors'' in the
|
|
||||||
* documentation or other materials provided with the distribution and in
|
|
||||||
* all advertising materials mentioning features or use of this software.
|
|
||||||
* Neither the name of the University nor the names of its contributors may
|
|
||||||
* be used to endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
|
||||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
|
||||||
* @(#)tzfile.h 5.9 (Berkeley) 6/11/90
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Information about time zone files.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Time zone object file directory */
|
|
||||||
#define TZDIR "/usr/share/zoneinfo"
|
|
||||||
#define TZDEFAULT "/etc/localtime"
|
|
||||||
#define TZDEFRULES "posixrules"
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Each file begins with. . .
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct tzhead {
|
|
||||||
char tzh_reserved[24]; /* reserved for future use */
|
|
||||||
char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */
|
|
||||||
char tzh_leapcnt[4]; /* coded number of leap seconds */
|
|
||||||
char tzh_timecnt[4]; /* coded number of transition times */
|
|
||||||
char tzh_typecnt[4]; /* coded number of local time types */
|
|
||||||
char tzh_charcnt[4]; /* coded number of abbr. chars */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
** . . .followed by. . .
|
|
||||||
**
|
|
||||||
** tzh_timecnt (char [4])s coded transition times a la time(2)
|
|
||||||
** tzh_timecnt (unsigned char)s types of local time starting at above
|
|
||||||
** tzh_typecnt repetitions of
|
|
||||||
** one (char [4]) coded GMT offset in seconds
|
|
||||||
** one (unsigned char) used to set tm_isdst
|
|
||||||
** one (unsigned char) that's an abbreviation list index
|
|
||||||
** tzh_charcnt (char)s '\0'-terminated zone abbreviations
|
|
||||||
** tzh_leapcnt repetitions of
|
|
||||||
** one (char [4]) coded leap second transition times
|
|
||||||
** one (char [4]) total correction after above
|
|
||||||
** tzh_ttisstdcnt (char)s indexed by type; if TRUE, transition
|
|
||||||
** time is standard time, if FALSE,
|
|
||||||
** transition time is wall clock time
|
|
||||||
** if absent, transition times are
|
|
||||||
** assumed to be wall clock time
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
** In the current implementation, "tzset()" refuses to deal with files that
|
|
||||||
** exceed any of the limits below.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
** The TZ_MAX_TIMES value below is enough to handle a bit more than a
|
|
||||||
** year's worth of solar time (corrected daily to the nearest second) or
|
|
||||||
** 138 years of Pacific Presidential Election time
|
|
||||||
** (where there are three time zone transitions every fourth year).
|
|
||||||
*/
|
|
||||||
#define TZ_MAX_TIMES 370
|
|
||||||
|
|
||||||
#define NOSOLAR /* 4BSD doesn't currently handle solar time */
|
|
||||||
|
|
||||||
#ifndef NOSOLAR
|
|
||||||
#define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */
|
|
||||||
#else
|
|
||||||
#define TZ_MAX_TYPES 10 /* Maximum number of local time types */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */
|
|
||||||
|
|
||||||
#define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */
|
|
||||||
|
|
||||||
#define SECSPERMIN 60
|
|
||||||
#define MINSPERHOUR 60
|
|
||||||
#define HOURSPERDAY 24
|
|
||||||
#define DAYSPERWEEK 7
|
|
||||||
#define DAYSPERNYEAR 365
|
|
||||||
#define DAYSPERLYEAR 366
|
|
||||||
#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR)
|
|
||||||
#define SECSPERDAY ((long) SECSPERHOUR * HOURSPERDAY)
|
|
||||||
#define MONSPERYEAR 12
|
|
||||||
|
|
||||||
#define TM_SUNDAY 0
|
|
||||||
#define TM_MONDAY 1
|
|
||||||
#define TM_TUESDAY 2
|
|
||||||
#define TM_WEDNESDAY 3
|
|
||||||
#define TM_THURSDAY 4
|
|
||||||
#define TM_FRIDAY 5
|
|
||||||
#define TM_SATURDAY 6
|
|
||||||
|
|
||||||
#define TM_JANUARY 0
|
|
||||||
#define TM_FEBRUARY 1
|
|
||||||
#define TM_MARCH 2
|
|
||||||
#define TM_APRIL 3
|
|
||||||
#define TM_MAY 4
|
|
||||||
#define TM_JUNE 5
|
|
||||||
#define TM_JULY 6
|
|
||||||
#define TM_AUGUST 7
|
|
||||||
#define TM_SEPTEMBER 8
|
|
||||||
#define TM_OCTOBER 9
|
|
||||||
#define TM_NOVEMBER 10
|
|
||||||
#define TM_DECEMBER 11
|
|
||||||
|
|
||||||
#define TM_YEAR_BASE 1900
|
|
||||||
|
|
||||||
#define EPOCH_YEAR 1970
|
|
||||||
#define EPOCH_WDAY TM_THURSDAY
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Accurate only for the past couple of centuries;
|
|
||||||
** that will probably do.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
|
|
||||||
|
|
||||||
#endif /* !_POSIX_SOURCE */
|
|
||||||
#endif /* !__STRICT_ANSI__ */
|
|
||||||
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
|
|
||||||
|
|
||||||
#ifndef __dj_ENFORCE_FUNCTION_CALLS
|
|
||||||
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __dj_include_tzfile_h__ */
|
|
|
@ -1,72 +0,0 @@
|
||||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
/* This file has been modified by DJ Delorie. These modifications are
|
|
||||||
** Copyright (C) 1995 DJ Delorie, 24 Kirsten Ave, Rochester NH,
|
|
||||||
** 03867-2954, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 1987, 1989 Regents of the University of California.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This code is derived from software contributed to Berkeley by
|
|
||||||
* Arthur David Olson of the National Cancer Institute.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms are permitted provided
|
|
||||||
* that: (1) source distributions retain this entire copyright notice and
|
|
||||||
* comment, and (2) distributions including binaries display the following
|
|
||||||
* acknowledgement: ``This product includes software developed by the
|
|
||||||
* University of California, Berkeley and its contributors'' in the
|
|
||||||
* documentation or other materials provided with the distribution and in
|
|
||||||
* all advertising materials mentioning features or use of this software.
|
|
||||||
* Neither the name of the University nor the names of its contributors may
|
|
||||||
* be used to endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
|
||||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <precomp.h>
|
|
||||||
#include "tzfile.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
wchar_t* _wasctime(const struct tm* timeptr)
|
|
||||||
{
|
|
||||||
#ifdef __GNUC__
|
|
||||||
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"
|
|
||||||
};
|
|
||||||
#else
|
|
||||||
static const wchar_t wday_name[DAYSPERWEEK][4] = {
|
|
||||||
L"Sun", L"Mon", L"Tue", L"Wed", L"Thu", L"Fri", L"Sat"
|
|
||||||
};
|
|
||||||
static const wchar_t mon_name[MONSPERYEAR][4] = {
|
|
||||||
L"Jan", L"Feb", L"Mar", L"Apr", L"May", L"Jun",
|
|
||||||
L"Jul", L"Aug", L"Sep", L"Oct", L"Nov", L"Dec"
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
wchar_t* _wctime(const time_t* const timep)
|
|
||||||
{
|
|
||||||
return _wasctime(localtime(timep));
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
/*
|
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
|
||||||
* PROJECT: ReactOS system libraries
|
|
||||||
* FILE: lib/msvcrt/time/strtime.c
|
|
||||||
* PURPOSE: Fills a buffer with a formatted date representation
|
|
||||||
* PROGRAMER: Ariadne
|
|
||||||
* UPDATE HISTORY:
|
|
||||||
* 28/12/98: Created
|
|
||||||
*/
|
|
||||||
#include <precomp.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
wchar_t* _wstrdate(wchar_t* date)
|
|
||||||
{
|
|
||||||
static const WCHAR format[] = { 'M','M','\'','/','\'','d','d','\'','/','\'','y','y',0 };
|
|
||||||
|
|
||||||
GetDateFormatW(LOCALE_NEUTRAL, 0, NULL, format, (LPWSTR)date, 9);
|
|
||||||
|
|
||||||
return date;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
/*
|
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
|
||||||
* PROJECT: ReactOS system libraries
|
|
||||||
* FILE: lib/msvcrt/time/strtime.c
|
|
||||||
* PURPOSE: Fills a buffer with a formatted time representation
|
|
||||||
* PROGRAMER: Ariadne
|
|
||||||
* UPDATE HISTORY:
|
|
||||||
* 28/12/98: Created
|
|
||||||
*/
|
|
||||||
#include <precomp.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
wchar_t* _wstrtime(wchar_t* time)
|
|
||||||
{
|
|
||||||
static const WCHAR format[] = { 'H','H','\'',':','\'','m','m','\'',':','\'','s','s',0 };
|
|
||||||
|
|
||||||
GetTimeFormatW(LOCALE_NEUTRAL, 0, NULL, format, (LPWSTR)time, 9);
|
|
||||||
|
|
||||||
return time;
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue