Implement proper time zone support

Cosmopolitan now supports 104 time zones. They're embedded inside any
binary that links the localtime() function. Doing so adds about 100kb
to the binary size. This change also gets time zones working properly
on Windows for the first time. It's not needed to have /etc/localtime
exist on Windows, since we can get this information from WIN32. We're
also now updated to the latest version of Paul Eggert's TZ library.
This commit is contained in:
Justine Tunney 2024-05-04 23:05:36 -07:00
parent d5ebb1fa5b
commit b0df6c1fce
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
627 changed files with 3052 additions and 2077 deletions

View file

@ -21,7 +21,7 @@ THIRD_PARTY_XXHASH_A_DIRECTDEPS = \
LIBC_STDIO \
LIBC_STR \
LIBC_SYSV \
LIBC_TIME
THIRD_PARTY_TZ
THIRD_PARTY_XXHASH_A_DEPS := \
$(call uniq,$(foreach x,$(THIRD_PARTY_XXHASH_A_DIRECTDEPS),$($(x))))

View file

@ -61,8 +61,7 @@
#include "libc/sysv/consts/clock.h"
#include "libc/sysv/consts/sched.h"
#include "libc/sysv/consts/timer.h"
#include "libc/time/struct/tm.h"
#include "libc/time/time.h" /* clock_t, clock, CLOCKS_PER_SEC */
#include "libc/time.h" /* clock_t, clock, CLOCKS_PER_SEC */
#include "libc/errno.h" /* errno */
#define TIMELOOP_S 1

View file

@ -87,7 +87,7 @@
#include "libc/sysv/consts/fileno.h"
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/ok.h"
#include "libc/time/time.h"
#include "libc/time.h"
#include "third_party/musl/crypt.h"
#include "third_party/musl/lockf.h" /* declares _POSIX_VERSION */
# if defined(_POSIX_VERSION) /* POSIX compliant */
@ -138,7 +138,7 @@
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/str/unicode.h"
#include "libc/time/time.h"
#include "libc/time.h"
# if WCHAR_MAX == 0xFFFFU /* UTF-16 wchar_t */
# define XSUM_WIN32_USE_WCHAR 1
# else

View file

@ -31,7 +31,7 @@
#include "libc/calls/weirdtypes.h"
#include "libc/sysv/consts/s.h"
#include "libc/sysv/consts/utime.h"
#include "libc/time/time.h" /* stat() / _stat64() */
#include "libc/time.h" /* stat() / _stat64() */
/*
* This file contains all of the ugly boilerplate to make xxhsum work across
@ -60,7 +60,7 @@
#include "libc/sysv/consts/fileno.h"
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/ok.h"
#include "libc/time/time.h"
#include "libc/time.h"
#include "third_party/musl/crypt.h"
#include "third_party/musl/lockf.h" /* isatty */
# define XSUM_IS_CONSOLE(stdStream) isatty(fileno(stdStream))
@ -207,7 +207,7 @@ int main(int argc, const char* argv[])
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/str/unicode.h"
#include "libc/time/time.h"
#include "libc/time.h"
/*****************************************************************************
* Unicode conversion tools

View file

@ -30,8 +30,7 @@ extern "C" {
#if defined(_MSC_VER)
// MISSING #include <sys/utime.h> /* utime */
#else
#include "libc/time/struct/utimbuf.h"
#include "libc/time/time.h" /* utime */
#include "libc/time.h" /* utime */
#endif
#include "libc/calls/calls.h"
#include "libc/calls/struct/timespec.h"
@ -40,8 +39,7 @@ extern "C" {
#include "libc/sysv/consts/clock.h"
#include "libc/sysv/consts/sched.h"
#include "libc/sysv/consts/timer.h"
#include "libc/time/struct/tm.h"
#include "libc/time/time.h" /* clock_t, clock, CLOCKS_PER_SEC */
#include "libc/time.h" /* clock_t, clock, CLOCKS_PER_SEC */

View file

@ -506,8 +506,7 @@ static inline int Filter_check(const Filter* bf, int bflog, uint64_t hash)
#include "libc/sysv/consts/clock.h"
#include "libc/sysv/consts/sched.h"
#include "libc/sysv/consts/timer.h"
#include "libc/time/struct/tm.h"
#include "libc/time/time.h" /* clock_t, clock, time_t, time, difftime */
#include "libc/time.h" /* clock_t, clock, time_t, time, difftime */
void update_indicator(uint64_t v, uint64_t total)
{