mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-15 11:00:04 +08:00
10d0021609
* libc/include/time.h (tzset, _tzset_r): Added prototypes. (strptime): Moved prototype to be within !__STRICT_ANSI__. (_tzname, _daylight, _timezone): No long __CYGWIN__ only. (tzname): Defined for all platforms. (daylight, timezone): Defined only for CYGWIN. * libc/sys/linux/machine/i386/crt0.c: Add call to tzset() after environment set up. * libc/stdlib/setenv_r.c (_setenv_r): Call tzset() if the TZ environment variable is set. * libc/time/Makefile.am: Add support for tzset.c, tzlock.c, and tzset_r.c. * libc/time/Makefile.in: Regenerated. * libc/time/gmtime.c (gmtime): Changed to call gmtime_r. * libc/time/gmtime_r.c (gmtime_r): Changed to call _mktm_r. * libc/time/lcltime_r.c (lcltime_r): Ditto. * libc/time/local.h: New local header file. * libc/time/mktime.c (mktime): Add timezone support. * libc/time/mktm_r.c: New file which is the common engine for gmtime_r and lcltime_r. This code has timezone support. * libc/time/strftime.c (strftime): Add %Z timezone support. * libc/time/tzlock.c: New file containing timezone lock stubs. * libc/time/tzset.c: New file containing tzset() routine. * libc/time/tzset_r.c: New file containing _tzset_r and internal routine for calculating timezone changes for specified year.
55 lines
1.2 KiB
C
55 lines
1.2 KiB
C
/* local header used by libc/time routines */
|
|
#include <_ansi.h>
|
|
#include <time.h>
|
|
|
|
#define SECSPERMIN 60L
|
|
#define MINSPERHOUR 60L
|
|
#define HOURSPERDAY 24L
|
|
#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR)
|
|
#define SECSPERDAY (SECSPERHOUR * HOURSPERDAY)
|
|
#define DAYSPERWEEK 7
|
|
#define MONSPERYEAR 12
|
|
|
|
#define YEAR_BASE 1900
|
|
#define EPOCH_YEAR 1970
|
|
#define EPOCH_WDAY 4
|
|
#define EPOCH_YEARS_SINCE_LEAP 2
|
|
#define EPOCH_YEARS_SINCE_CENTURY 70
|
|
#define EPOCH_YEARS_SINCE_LEAP_CENTURY 370
|
|
|
|
#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
|
|
|
|
extern time_t __tzstart_std;
|
|
extern time_t __tzstart_dst;
|
|
extern int __tznorth;
|
|
extern int __tzyear;
|
|
|
|
typedef struct __tzrule_struct
|
|
{
|
|
char ch;
|
|
int m;
|
|
int n;
|
|
int d;
|
|
int s;
|
|
time_t change;
|
|
int offset;
|
|
} __tzrule_type;
|
|
|
|
extern __tzrule_type __tzrule[2];
|
|
|
|
struct tm * _EXFUN (_mktm_r, (_CONST time_t *, struct tm *, int __is_gmtime));
|
|
int _EXFUN (__tzcalc_limits, (int __year));
|
|
|
|
/* locks for multi-threading */
|
|
#ifdef __SINGLE_THREAD__
|
|
#define TZ_LOCK
|
|
#define TZ_UNLOCK
|
|
#else
|
|
#define TZ_LOCK __tz_lock()
|
|
#define TZ_UNLOCK __tz_unlock()
|
|
#endif
|
|
|
|
void _EXFUN(__tz_lock,(_VOID));
|
|
void _EXFUN(__tz_unlock,(_VOID));
|
|
|