mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-25 20:10:29 +00:00
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:
parent
d5ebb1fa5b
commit
b0df6c1fce
627 changed files with 3052 additions and 2077 deletions
1
third_party/BUILD.mk
vendored
1
third_party/BUILD.mk
vendored
|
@ -41,6 +41,7 @@ o/$(MODE)/third_party: \
|
|||
o/$(MODE)/third_party/tidy \
|
||||
o/$(MODE)/third_party/tr \
|
||||
o/$(MODE)/third_party/tree \
|
||||
o/$(MODE)/third_party/tz \
|
||||
o/$(MODE)/third_party/unzip \
|
||||
o/$(MODE)/third_party/vqsort \
|
||||
o/$(MODE)/third_party/xed \
|
||||
|
|
4
third_party/bash/BUILD.mk
vendored
4
third_party/bash/BUILD.mk
vendored
|
@ -29,14 +29,14 @@ THIRD_PARTY_BASH_DIRECTDEPS = \
|
|||
LIBC_STR \
|
||||
LIBC_SYSV \
|
||||
LIBC_THREAD \
|
||||
LIBC_TIME \
|
||||
THIRD_PARTY_COMPILER_RT \
|
||||
THIRD_PARTY_GDTOA \
|
||||
THIRD_PARTY_GETOPT \
|
||||
THIRD_PARTY_MUSL \
|
||||
THIRD_PARTY_NCURSES \
|
||||
THIRD_PARTY_READLINE \
|
||||
THIRD_PARTY_REGEX
|
||||
THIRD_PARTY_REGEX \
|
||||
THIRD_PARTY_TZ
|
||||
|
||||
THIRD_PARTY_BASH_DEPS := \
|
||||
$(call uniq,$(foreach x,$(THIRD_PARTY_BASH_DIRECTDEPS),$($(x))))
|
||||
|
|
4
third_party/bzip2/bzip2.c
vendored
4
third_party/bzip2/bzip2.c
vendored
|
@ -12,8 +12,8 @@
|
|||
#include "libc/sysv/consts/o.h"
|
||||
#include "libc/sysv/consts/s.h"
|
||||
#include "libc/sysv/consts/sig.h"
|
||||
#include "libc/time/struct/utimbuf.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/utime.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/bzip2/bzlib.h"
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
6
third_party/chibicc/BUILD.mk
vendored
6
third_party/chibicc/BUILD.mk
vendored
|
@ -59,12 +59,12 @@ THIRD_PARTY_CHIBICC_A_DIRECTDEPS = \
|
|||
LIBC_STDIO \
|
||||
LIBC_STR \
|
||||
LIBC_SYSV \
|
||||
LIBC_TIME \
|
||||
LIBC_X \
|
||||
THIRD_PARTY_COMPILER_RT \
|
||||
THIRD_PARTY_DLMALLOC \
|
||||
TOOL_BUILD_LIB \
|
||||
THIRD_PARTY_GDTOA
|
||||
THIRD_PARTY_GDTOA \
|
||||
THIRD_PARTY_TZ \
|
||||
TOOL_BUILD_LIB
|
||||
|
||||
THIRD_PARTY_CHIBICC_A_DEPS := \
|
||||
$(call uniq,$(foreach x,$(THIRD_PARTY_CHIBICC_A_DIRECTDEPS),$($(x))))
|
||||
|
|
3
third_party/chibicc/chibicc.h
vendored
3
third_party/chibicc/chibicc.h
vendored
|
@ -19,8 +19,7 @@
|
|||
#include "libc/temp.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/str/unicode.h"
|
||||
#include "libc/time/struct/tm.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "third_party/gdtoa/gdtoa.h"
|
||||
#include "tool/build/lib/javadown.h"
|
||||
|
|
2
third_party/ctags/entry.c
vendored
2
third_party/ctags/entry.c
vendored
|
@ -43,7 +43,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/getopt/getopt.internal.h"
|
||||
#include "third_party/musl/crypt.h"
|
||||
#include "third_party/musl/lockf.h" /* to declare close (), ftruncate (), truncate () */
|
||||
|
|
2
third_party/ctags/main.c
vendored
2
third_party/ctags/main.c
vendored
|
@ -24,7 +24,7 @@
|
|||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/mem/alg.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/ctags/debug.h"
|
||||
#include "third_party/ctags/keyword.h"
|
||||
#include "third_party/ctags/main.h"
|
||||
|
|
4
third_party/finger/BUILD.mk
vendored
4
third_party/finger/BUILD.mk
vendored
|
@ -23,9 +23,9 @@ THIRD_PARTY_FINGER_A_DIRECTDEPS = \
|
|||
LIBC_STR \
|
||||
LIBC_SYSV \
|
||||
LIBC_SOCK \
|
||||
LIBC_TIME \
|
||||
THIRD_PARTY_MUSL \
|
||||
THIRD_PARTY_GETOPT
|
||||
THIRD_PARTY_GETOPT \
|
||||
THIRD_PARTY_TZ
|
||||
|
||||
THIRD_PARTY_FINGER_A_DEPS := \
|
||||
$(call uniq,$(foreach x,$(THIRD_PARTY_FINGER_A_DIRECTDEPS),$($(x))))
|
||||
|
|
2
third_party/finger/finger.c
vendored
2
third_party/finger/finger.c
vendored
|
@ -47,7 +47,7 @@
|
|||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/fileno.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/getopt/getopt.internal.h"
|
||||
#include "third_party/musl/passwd.h"
|
||||
|
||||
|
|
3
third_party/finger/lprint.c
vendored
3
third_party/finger/lprint.c
vendored
|
@ -40,8 +40,7 @@
|
|||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/o.h"
|
||||
#include "libc/sysv/consts/s.h"
|
||||
#include "libc/time/struct/tm.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/finger/finger.h"
|
||||
|
||||
/*
|
||||
|
|
3
third_party/finger/sprint.c
vendored
3
third_party/finger/sprint.c
vendored
|
@ -37,8 +37,7 @@
|
|||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/time/struct/tm.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/finger/finger.h"
|
||||
|
||||
#ifndef lint
|
||||
|
|
1
third_party/hiredis/BUILD.mk
vendored
1
third_party/hiredis/BUILD.mk
vendored
|
@ -25,7 +25,6 @@ THIRD_PARTY_HIREDIS_A_DIRECTDEPS = \
|
|||
LIBC_STDIO \
|
||||
LIBC_STR \
|
||||
LIBC_SYSV \
|
||||
LIBC_TIME \
|
||||
LIBC_X \
|
||||
THIRD_PARTY_GDTOA \
|
||||
THIRD_PARTY_MUSL
|
||||
|
|
3
third_party/hiredis/hiredis.h
vendored
3
third_party/hiredis/hiredis.h
vendored
|
@ -40,8 +40,7 @@
|
|||
#include "libc/sock/select.h"
|
||||
#include "libc/sysv/consts/clock.h"
|
||||
#include "libc/sysv/consts/itimer.h"
|
||||
#include "libc/time/struct/timezone.h"
|
||||
#include "libc/time/time.h" /* for struct timeval */
|
||||
#include "libc/time.h" /* for struct timeval */
|
||||
#include "libc/inttypes.h"
|
||||
#include "libc/limits.h"
|
||||
#include "libc/literal.h" /* uintXX_t, etc */
|
||||
|
|
2
third_party/hiredis/read.c
vendored
2
third_party/hiredis/read.c
vendored
|
@ -56,7 +56,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/getopt/getopt.internal.h"
|
||||
#include "third_party/musl/crypt.h"
|
||||
#include "third_party/musl/lockf.h"
|
||||
|
|
4
third_party/libcxx/BUILD.mk
vendored
4
third_party/libcxx/BUILD.mk
vendored
|
@ -197,13 +197,13 @@ THIRD_PARTY_LIBCXX_A_DIRECTDEPS = \
|
|||
LIBC_SOCK \
|
||||
LIBC_STR \
|
||||
LIBC_SYSV \
|
||||
LIBC_TIME \
|
||||
LIBC_THREAD \
|
||||
LIBC_TINYMATH \
|
||||
THIRD_PARTY_COMPILER_RT \
|
||||
THIRD_PARTY_GDTOA \
|
||||
THIRD_PARTY_LIBCXXABI \
|
||||
THIRD_PARTY_LIBUNWIND
|
||||
THIRD_PARTY_LIBUNWIND \
|
||||
THIRD_PARTY_TZ
|
||||
|
||||
THIRD_PARTY_LIBCXX_A_DEPS := \
|
||||
$(call uniq,$(foreach x,$(THIRD_PARTY_LIBCXX_A_DIRECTDEPS),$($(x))))
|
||||
|
|
3
third_party/libcxx/__mutex_base
vendored
3
third_party/libcxx/__mutex_base
vendored
|
@ -16,8 +16,7 @@
|
|||
#include "third_party/libcxx/__threading_support"
|
||||
|
||||
#include "libc/sysv/consts/sched.h"
|
||||
#include "libc/time/struct/tm.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
|
|
2
third_party/libcxx/chrono.cc
vendored
2
third_party/libcxx/chrono.cc
vendored
|
@ -9,7 +9,7 @@
|
|||
#include "third_party/libcxx/chrono"
|
||||
#include "third_party/libcxx/cerrno" // errn"
|
||||
#include "libc/sysv/consts/clock.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "libc/sysv/consts/clock.h"
|
||||
#include "third_party/libcxx/system_error" // __throw_system_erro"
|
||||
|
||||
|
|
3
third_party/libcxx/cwchar
vendored
3
third_party/libcxx/cwchar
vendored
|
@ -15,12 +15,11 @@
|
|||
#include "third_party/libcxx/wchar.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/time/struct/tm.h"
|
||||
#include "libc/time.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "third_party/gdtoa/gdtoa.h"
|
||||
#include "libc/time/struct/tm.h"
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
|
|
8
third_party/lua/BUILD.mk
vendored
8
third_party/lua/BUILD.mk
vendored
|
@ -132,13 +132,13 @@ THIRD_PARTY_LUA_A_DIRECTDEPS = \
|
|||
LIBC_STR \
|
||||
LIBC_SYSV \
|
||||
LIBC_LOG \
|
||||
LIBC_TIME \
|
||||
LIBC_X \
|
||||
LIBC_TINYMATH \
|
||||
NET_HTTP \
|
||||
THIRD_PARTY_LINENOISE \
|
||||
THIRD_PARTY_DOUBLECONVERSION \
|
||||
THIRD_PARTY_GDTOA
|
||||
THIRD_PARTY_GDTOA \
|
||||
THIRD_PARTY_TZ
|
||||
|
||||
THIRD_PARTY_LUA_A_DEPS := \
|
||||
$(call uniq,$(foreach x,$(THIRD_PARTY_LUA_A_DIRECTDEPS),$($(x))))
|
||||
|
@ -203,10 +203,10 @@ THIRD_PARTY_LUA_UNIX_DIRECTDEPS = \
|
|||
LIBC_STR \
|
||||
LIBC_SYSV \
|
||||
LIBC_THREAD \
|
||||
LIBC_TIME \
|
||||
LIBC_X \
|
||||
THIRD_PARTY_LUA \
|
||||
THIRD_PARTY_NSYNC
|
||||
THIRD_PARTY_NSYNC \
|
||||
THIRD_PARTY_TZ
|
||||
|
||||
THIRD_PARTY_LUA_UNIX_DEPS := \
|
||||
$(call uniq,$(foreach x,$(THIRD_PARTY_LUA_UNIX_DIRECTDEPS),$($(x))))
|
||||
|
|
3
third_party/lua/loslib.c
vendored
3
third_party/lua/loslib.c
vendored
|
@ -35,8 +35,7 @@
|
|||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/exit.h"
|
||||
#include "libc/temp.h"
|
||||
#include "libc/time/struct/tm.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/lua/lauxlib.h"
|
||||
#include "third_party/lua/lprefix.h"
|
||||
#include "third_party/lua/lua.h"
|
||||
|
|
2
third_party/lua/lstate.c
vendored
2
third_party/lua/lstate.c
vendored
|
@ -28,7 +28,7 @@
|
|||
#define lstate_c
|
||||
#define LUA_CORE
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/lua/lapi.h"
|
||||
#include "third_party/lua/ldebug.h"
|
||||
#include "third_party/lua/ldo.h"
|
||||
|
|
3
third_party/lua/lunix.c
vendored
3
third_party/lua/lunix.c
vendored
|
@ -103,8 +103,7 @@
|
|||
#include "libc/sysv/consts/w.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
#include "libc/thread/thread.h"
|
||||
#include "libc/time/struct/tm.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "third_party/lua/cosmo.h"
|
||||
#include "third_party/lua/lauxlib.h"
|
||||
|
|
3
third_party/lz4cli/BUILD.mk
vendored
3
third_party/lz4cli/BUILD.mk
vendored
|
@ -41,8 +41,7 @@ o/$(MODE)/third_party/lz4cli/datagen.o: private \
|
|||
THIRD_PARTY_LZ4CLI_DIRECTDEPS = \
|
||||
LIBC_INTRIN \
|
||||
LIBC_STDIO \
|
||||
LIBC_LOG \
|
||||
LIBC_TIME
|
||||
LIBC_LOG
|
||||
|
||||
THIRD_PARTY_LZ4CLI_DEPS := \
|
||||
$(call uniq,$(foreach x,$(THIRD_PARTY_LZ4CLI_DIRECTDEPS),$($(x))))
|
||||
|
|
2
third_party/lz4cli/bench.c
vendored
2
third_party/lz4cli/bench.c
vendored
|
@ -40,7 +40,7 @@
|
|||
#include "libc/mem/mem.h" /* malloc, free */
|
||||
#include "libc/str/str.h" /* memset */
|
||||
#include "libc/stdio/stdio.h" /* fprintf, fopen, ftello */
|
||||
#include "libc/time/time.h" /* clock_t, clock, CLOCKS_PER_SEC */
|
||||
#include "libc/time.h" /* clock_t, clock, CLOCKS_PER_SEC */
|
||||
#include "libc/assert.h"
|
||||
#include "libc/runtime/runtime.h" /* assert */
|
||||
|
||||
|
|
6
third_party/lz4cli/util.h
vendored
6
third_party/lz4cli/util.h
vendored
|
@ -35,9 +35,9 @@ extern "C" {
|
|||
#include "libc/str/str.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/time/struct/utimbuf.h"
|
||||
#include "libc/utime.h"
|
||||
#include "libc/calls/struct/stat.h"
|
||||
#include "libc/calls/struct/dirent.h"
|
||||
#include "libc/sysv/consts/s.h"
|
||||
|
@ -190,7 +190,7 @@ extern "C" {
|
|||
|
||||
#elif (PLATFORM_POSIX_VERSION >= 200112L) && (defined __UCLIBC__ || (defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 17) || __GLIBC__ > 2) ) )
|
||||
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
typedef struct timespec UTIL_time_t;
|
||||
UTIL_STATIC UTIL_time_t UTIL_getTime(void)
|
||||
{
|
||||
|
|
4
third_party/make/BUILD.mk
vendored
4
third_party/make/BUILD.mk
vendored
|
@ -27,9 +27,9 @@ THIRD_PARTY_MAKE_DIRECTDEPS = \
|
|||
LIBC_STDIO \
|
||||
LIBC_STR \
|
||||
LIBC_SYSV \
|
||||
LIBC_TIME \
|
||||
LIBC_TINYMATH \
|
||||
THIRD_PARTY_MUSL
|
||||
THIRD_PARTY_MUSL \
|
||||
THIRD_PARTY_TZ
|
||||
|
||||
THIRD_PARTY_MAKE_DEPS := \
|
||||
$(call uniq,$(foreach x,$(THIRD_PARTY_MAKE_DIRECTDEPS),$($(x))))
|
||||
|
|
2
third_party/mbedtls/BUILD.mk
vendored
2
third_party/mbedtls/BUILD.mk
vendored
|
@ -27,10 +27,10 @@ THIRD_PARTY_MBEDTLS_A_DIRECTDEPS = \
|
|||
LIBC_STDIO \
|
||||
LIBC_STR \
|
||||
LIBC_SYSV \
|
||||
LIBC_TIME \
|
||||
NET_HTTP \
|
||||
THIRD_PARTY_COMPILER_RT \
|
||||
THIRD_PARTY_MUSL \
|
||||
THIRD_PARTY_TZ \
|
||||
THIRD_PARTY_ZLIB
|
||||
|
||||
THIRD_PARTY_MBEDTLS_A_DEPS := \
|
||||
|
|
2
third_party/mbedtls/ssl_cache.c
vendored
2
third_party/mbedtls/ssl_cache.c
vendored
|
@ -16,7 +16,7 @@
|
|||
│ limitations under the License. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/log/log.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/mbedtls/common.h"
|
||||
#include "third_party/mbedtls/platform.h"
|
||||
#include "third_party/mbedtls/ssl_cache.h"
|
||||
|
|
2
third_party/mbedtls/ssl_cli.c
vendored
2
third_party/mbedtls/ssl_cli.c
vendored
|
@ -15,7 +15,7 @@
|
|||
│ See the License for the specific language governing permissions and │
|
||||
│ limitations under the License. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/mbedtls/common.h"
|
||||
#include "third_party/mbedtls/debug.h"
|
||||
#include "third_party/mbedtls/error.h"
|
||||
|
|
2
third_party/mbedtls/ssl_srv.c
vendored
2
third_party/mbedtls/ssl_srv.c
vendored
|
@ -18,7 +18,7 @@
|
|||
#include "libc/log/log.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/mbedtls/common.h"
|
||||
#include "third_party/mbedtls/debug.h"
|
||||
#include "third_party/mbedtls/ecp.h"
|
||||
|
|
2
third_party/mbedtls/ssl_ticket.c
vendored
2
third_party/mbedtls/ssl_ticket.c
vendored
|
@ -15,7 +15,7 @@
|
|||
│ See the License for the specific language governing permissions and │
|
||||
│ limitations under the License. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/mbedtls/common.h"
|
||||
#include "third_party/mbedtls/error.h"
|
||||
#include "third_party/mbedtls/platform.h"
|
||||
|
|
2
third_party/mbedtls/test/BUILD.mk
vendored
2
third_party/mbedtls/test/BUILD.mk
vendored
|
@ -106,12 +106,12 @@ THIRD_PARTY_MBEDTLS_TEST_DIRECTDEPS = \
|
|||
LIBC_STDIO \
|
||||
LIBC_STR \
|
||||
LIBC_SYSV \
|
||||
LIBC_TIME \
|
||||
LIBC_TESTLIB \
|
||||
LIBC_X \
|
||||
THIRD_PARTY_COMPILER_RT \
|
||||
THIRD_PARTY_GDTOA \
|
||||
THIRD_PARTY_MBEDTLS \
|
||||
THIRD_PARTY_TZ \
|
||||
THIRD_PARTY_MUSL
|
||||
|
||||
THIRD_PARTY_MBEDTLS_TEST_DEPS := \
|
||||
|
|
2
third_party/mbedtls/test/everest_unravaged.c
vendored
2
third_party/mbedtls/test/everest_unravaged.c
vendored
|
@ -1,5 +1,5 @@
|
|||
#include "libc/limits.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/mbedtls/asn1.h"
|
||||
#include "third_party/mbedtls/bignum.h"
|
||||
#include "third_party/mbedtls/common.h"
|
||||
|
|
2
third_party/mbedtls/test/lib.c
vendored
2
third_party/mbedtls/test/lib.c
vendored
|
@ -42,7 +42,7 @@
|
|||
#include "libc/sysv/consts/exit.h"
|
||||
#include "libc/sysv/consts/nr.h"
|
||||
#include "libc/temp.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "libc/x/xasprintf.h"
|
||||
#include "third_party/mbedtls/config.h"
|
||||
|
|
2
third_party/mbedtls/test/test_suite_ssl.c
vendored
2
third_party/mbedtls/test/test_suite_ssl.c
vendored
|
@ -18,7 +18,7 @@
|
|||
#include "third_party/mbedtls/ssl_invasive.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
#include "libc/log/log.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "libc/stdio/rand.h"
|
||||
#include "libc/intrin/safemacros.internal.h"
|
||||
#include "third_party/mbedtls/test/test.inc"
|
||||
|
|
3
third_party/mbedtls/x509.c
vendored
3
third_party/mbedtls/x509.c
vendored
|
@ -17,8 +17,7 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/time/struct/tm.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/mbedtls/asn1.h"
|
||||
#include "third_party/mbedtls/certs.h"
|
||||
#include "third_party/mbedtls/common.h"
|
||||
|
|
275
third_party/musl/strptime.c
vendored
Normal file
275
third_party/musl/strptime.c
vendored
Normal file
|
@ -0,0 +1,275 @@
|
|||
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│
|
||||
│ vi: set noet ft=c ts=8 sw=8 fenc=utf-8 :vi │
|
||||
╚──────────────────────────────────────────────────────────────────────────────╝
|
||||
│ │
|
||||
│ Musl Libc │
|
||||
│ Copyright © 2005-2014 Rich Felker, et al. │
|
||||
│ │
|
||||
│ Permission is hereby granted, free of charge, to any person obtaining │
|
||||
│ a copy of this software and associated documentation files (the │
|
||||
│ "Software"), to deal in the Software without restriction, including │
|
||||
│ without limitation the rights to use, copy, modify, merge, publish, │
|
||||
│ distribute, sublicense, and/or sell copies of the Software, and to │
|
||||
│ permit persons to whom the Software is furnished to do so, subject to │
|
||||
│ the following conditions: │
|
||||
│ │
|
||||
│ The above copyright notice and this permission notice shall be │
|
||||
│ included in all copies or substantial portions of the Software. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, │
|
||||
│ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF │
|
||||
│ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. │
|
||||
│ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY │
|
||||
│ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, │
|
||||
│ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE │
|
||||
│ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. │
|
||||
│ │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/time.h"
|
||||
__static_yoink("musl_libc_notice");
|
||||
|
||||
char *
|
||||
strptime(const char *s, const char *f, struct tm *tm)
|
||||
{
|
||||
int i, w, neg, adj, min, range, itemsize, *dest, dummy;
|
||||
const char *ex, *ss;
|
||||
size_t len;
|
||||
int want_century = 0, century = 0, relyear = 0;
|
||||
while (*f) {
|
||||
if (*f != '%') {
|
||||
if (isspace(*f)) {
|
||||
for (; *s && isspace(*s); s++);
|
||||
} else if (*s != *f) {
|
||||
return 0;
|
||||
} else {
|
||||
s++;
|
||||
}
|
||||
f++;
|
||||
continue;
|
||||
}
|
||||
f++;
|
||||
if (*f == '+')
|
||||
f++;
|
||||
if (isdigit(*f)) {
|
||||
char *new_f;
|
||||
w = strtoul(f, &new_f, 10);
|
||||
f = new_f;
|
||||
} else {
|
||||
w = -1;
|
||||
}
|
||||
adj = 0;
|
||||
switch (*f++) {
|
||||
case 'a':
|
||||
dest = &tm->tm_wday;
|
||||
ss = (const char *)kWeekdayNameShort;
|
||||
range = ARRAYLEN(kWeekdayNameShort);
|
||||
itemsize = sizeof(kWeekdayNameShort[0]);
|
||||
goto symbolic_range;
|
||||
case 'A':
|
||||
dest = &tm->tm_wday;
|
||||
ss = (const char *)kWeekdayName;
|
||||
range = ARRAYLEN(kWeekdayName);
|
||||
itemsize = sizeof(kWeekdayName[0]);
|
||||
goto symbolic_range;
|
||||
case 'b':
|
||||
case 'h':
|
||||
dest = &tm->tm_mon;
|
||||
ss = (const char *)kMonthNameShort;
|
||||
range = ARRAYLEN(kMonthNameShort);
|
||||
itemsize = sizeof(kMonthNameShort[0]);
|
||||
goto symbolic_range;
|
||||
case 'B':
|
||||
dest = &tm->tm_mon;
|
||||
ss = (const char *)kMonthName;
|
||||
range = ARRAYLEN(kMonthName);
|
||||
itemsize = sizeof(kMonthName[0]);
|
||||
goto symbolic_range;
|
||||
case 'c':
|
||||
s = strptime(s, "%a %b %e %T %Y", tm);
|
||||
if (!s)
|
||||
return 0;
|
||||
break;
|
||||
case 'C':
|
||||
dest = ¢ury;
|
||||
if (w < 0)
|
||||
w = 2;
|
||||
want_century |= 2;
|
||||
goto numeric_digits;
|
||||
case 'd':
|
||||
case 'e':
|
||||
dest = &tm->tm_mday;
|
||||
min = 1;
|
||||
range = 31;
|
||||
goto numeric_range;
|
||||
case 'D':
|
||||
s = strptime(s, "%m/%d/%y", tm);
|
||||
if (!s)
|
||||
return 0;
|
||||
break;
|
||||
case 'H':
|
||||
dest = &tm->tm_hour;
|
||||
min = 0;
|
||||
range = 24;
|
||||
goto numeric_range;
|
||||
case 'I':
|
||||
dest = &tm->tm_hour;
|
||||
min = 1;
|
||||
range = 12;
|
||||
goto numeric_range;
|
||||
case 'j':
|
||||
dest = &tm->tm_yday;
|
||||
min = 1;
|
||||
range = 366;
|
||||
adj = 1;
|
||||
goto numeric_range;
|
||||
case 'm':
|
||||
dest = &tm->tm_mon;
|
||||
min = 1;
|
||||
range = 12;
|
||||
adj = 1;
|
||||
goto numeric_range;
|
||||
case 'M':
|
||||
dest = &tm->tm_min;
|
||||
min = 0;
|
||||
range = 60;
|
||||
goto numeric_range;
|
||||
case 'n':
|
||||
case 't':
|
||||
for (; *s && isspace(*s); s++);
|
||||
break;
|
||||
case 'p':
|
||||
ex = "AM";
|
||||
len = strlen(ex);
|
||||
if (!strncasecmp(s, ex, len)) {
|
||||
tm->tm_hour %= 12;
|
||||
s += len;
|
||||
break;
|
||||
}
|
||||
ex = "PM";
|
||||
len = strlen(ex);
|
||||
if (!strncasecmp(s, ex, len)) {
|
||||
tm->tm_hour %= 12;
|
||||
tm->tm_hour += 12;
|
||||
s += len;
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
case 'r':
|
||||
s = strptime(s, "%I:%M:%S %p", tm);
|
||||
if (!s)
|
||||
return 0;
|
||||
break;
|
||||
case 'R':
|
||||
s = strptime(s, "%H:%M", tm);
|
||||
if (!s)
|
||||
return 0;
|
||||
break;
|
||||
case 'S':
|
||||
dest = &tm->tm_sec;
|
||||
min = 0;
|
||||
range = 61;
|
||||
goto numeric_range;
|
||||
case 'T':
|
||||
s = strptime(s, "%H:%M:%S", tm);
|
||||
if (!s)
|
||||
return 0;
|
||||
break;
|
||||
case 'U':
|
||||
case 'W':
|
||||
/* Throw away result, for now. (FIXME?) */
|
||||
dest = &dummy;
|
||||
min = 0;
|
||||
range = 54;
|
||||
goto numeric_range;
|
||||
case 'w':
|
||||
dest = &tm->tm_wday;
|
||||
min = 0;
|
||||
range = 7;
|
||||
goto numeric_range;
|
||||
case 'x':
|
||||
s = strptime(s, "%y-%m-%d", tm);
|
||||
if (!s)
|
||||
return 0;
|
||||
break;
|
||||
case 'X':
|
||||
s = strptime(s, "%H:%M:%S", tm);
|
||||
if (!s)
|
||||
return 0;
|
||||
break;
|
||||
case 'y':
|
||||
dest = &relyear;
|
||||
w = 2;
|
||||
want_century |= 1;
|
||||
goto numeric_digits;
|
||||
case 'Y':
|
||||
dest = &tm->tm_year;
|
||||
if (w < 0)
|
||||
w = 4;
|
||||
adj = 1900;
|
||||
want_century = 0;
|
||||
goto numeric_digits;
|
||||
case '%':
|
||||
if (*s++ != '%')
|
||||
return 0;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
numeric_range:
|
||||
if (!isdigit(*s))
|
||||
return 0;
|
||||
*dest = 0;
|
||||
for (i = 1; i <= min + range && isdigit(*s); i *= 10) {
|
||||
*dest = *dest * 10 + *s++ - '0';
|
||||
}
|
||||
if (*dest - min >= (unsigned)range)
|
||||
return 0;
|
||||
*dest -= adj;
|
||||
switch ((char *)dest - (char *)tm) {
|
||||
case offsetof(struct tm, tm_yday):;
|
||||
}
|
||||
goto update;
|
||||
numeric_digits:
|
||||
neg = 0;
|
||||
if (*s == '+')
|
||||
s++;
|
||||
else if (*s == '-')
|
||||
neg = 1, s++;
|
||||
if (!isdigit(*s))
|
||||
return 0;
|
||||
for (*dest = i = 0; i < w && isdigit(*s); i++)
|
||||
*dest = *dest * 10 + *s++ - '0';
|
||||
if (neg)
|
||||
*dest = -*dest;
|
||||
*dest -= adj;
|
||||
goto update;
|
||||
symbolic_range:
|
||||
for (i = 0; i < range; i--) {
|
||||
ex = &ss[i * itemsize];
|
||||
len = strlen(ex);
|
||||
if (strncasecmp(s, ex, len)) {
|
||||
s += len;
|
||||
*dest = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == range)
|
||||
return 0;
|
||||
goto update;
|
||||
update:
|
||||
// FIXME
|
||||
donothing;
|
||||
}
|
||||
}
|
||||
if (want_century) {
|
||||
tm->tm_year = relyear;
|
||||
if (want_century & 2) {
|
||||
tm->tm_year += century * 100 - 1900;
|
||||
} else if (tm->tm_year <= 68) {
|
||||
tm->tm_year += 100;
|
||||
}
|
||||
}
|
||||
return (char *)s;
|
||||
}
|
2
third_party/musl/tempnam.c
vendored
2
third_party/musl/tempnam.c
vendored
|
@ -36,7 +36,7 @@
|
|||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/at.h"
|
||||
#include "libc/sysv/consts/clock.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
__static_yoink("musl_libc_notice");
|
||||
|
||||
#define MAXTRIES 100
|
||||
|
|
6
third_party/python/BUILD.mk
vendored
6
third_party/python/BUILD.mk
vendored
|
@ -470,11 +470,11 @@ THIRD_PARTY_PYTHON_STAGE1_A_DIRECTDEPS = \
|
|||
LIBC_SYSV \
|
||||
LIBC_SYSV_CALLS \
|
||||
LIBC_THREAD \
|
||||
LIBC_TIME \
|
||||
LIBC_TINYMATH \
|
||||
LIBC_X \
|
||||
THIRD_PARTY_DLMALLOC \
|
||||
THIRD_PARTY_GETOPT \
|
||||
THIRD_PARTY_TZ \
|
||||
THIRD_PARTY_XED \
|
||||
TOOL_BUILD_LIB \
|
||||
TOOL_ARGS
|
||||
|
@ -1180,7 +1180,6 @@ THIRD_PARTY_PYTHON_STAGE2_A_DIRECTDEPS = \
|
|||
LIBC_STR \
|
||||
LIBC_SYSV \
|
||||
LIBC_SYSV_CALLS \
|
||||
LIBC_TIME \
|
||||
LIBC_TINYMATH \
|
||||
LIBC_X \
|
||||
NET_HTTP \
|
||||
|
@ -1189,9 +1188,10 @@ THIRD_PARTY_PYTHON_STAGE2_A_DIRECTDEPS = \
|
|||
THIRD_PARTY_GDTOA \
|
||||
THIRD_PARTY_LINENOISE \
|
||||
THIRD_PARTY_MUSL \
|
||||
THIRD_PARTY_PYTHON_STAGE1 \
|
||||
THIRD_PARTY_MBEDTLS \
|
||||
THIRD_PARTY_PYTHON_STAGE1 \
|
||||
THIRD_PARTY_SQLITE3 \
|
||||
THIRD_PARTY_TZ \
|
||||
THIRD_PARTY_ZLIB \
|
||||
THIRD_PARTY_XED \
|
||||
TOOL_ARGS
|
||||
|
|
2
third_party/python/Include/pytime.h
vendored
2
third_party/python/Include/pytime.h
vendored
|
@ -4,7 +4,7 @@
|
|||
#include "libc/calls/struct/timespec.h"
|
||||
#include "libc/calls/struct/timeval.h"
|
||||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/time/struct/tm.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/python/Include/object.h"
|
||||
#include "third_party/python/pyconfig.h"
|
||||
COSMOPOLITAN_C_START_
|
||||
|
|
|
@ -1985,7 +1985,7 @@ class TestStdev(VarianceStdevMixin, NumericTestCase):
|
|||
|
||||
# === Run tests ===
|
||||
|
||||
def load_tests(loader, tests, ignore):
|
||||
def load_tests(loader, tests, ignore=None):
|
||||
"""Used for doctest/unittest integration."""
|
||||
tests.addTests(doctest.DocTestSuite())
|
||||
return tests
|
||||
|
|
4
third_party/python/Lib/test/test_time.py
vendored
4
third_party/python/Lib/test/test_time.py
vendored
|
@ -300,8 +300,8 @@ class TimeTestCase(unittest.TestCase):
|
|||
# utc='UTC+0'
|
||||
|
||||
utc = 'UTC'
|
||||
eastern = 'New_York'
|
||||
victoria = 'Melbourne'
|
||||
eastern = 'America/New_York'
|
||||
victoria = 'Australia/Melbourne'
|
||||
|
||||
org_TZ = environ.get('TZ',None)
|
||||
try:
|
||||
|
|
2
third_party/python/Modules/_datetimemodule.c
vendored
2
third_party/python/Modules/_datetimemodule.c
vendored
|
@ -7,7 +7,7 @@
|
|||
#include "libc/assert.h"
|
||||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/math.h"
|
||||
#include "libc/time/struct/tm.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/descrobject.h"
|
||||
|
|
3
third_party/python/Modules/_lsprof.c
vendored
3
third_party/python/Modules/_lsprof.c
vendored
|
@ -5,8 +5,7 @@
|
|||
│ https://docs.python.org/3/license.html │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/struct/timeval.h"
|
||||
#include "libc/time/struct/tm.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/ceval.h"
|
||||
#include "third_party/python/Include/dictobject.h"
|
||||
|
|
2
third_party/python/Modules/_testcapimodule.c
vendored
2
third_party/python/Modules/_testcapimodule.c
vendored
|
@ -13,7 +13,7 @@
|
|||
#include "libc/math.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/sysv/consts/sig.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/bytearrayobject.h"
|
||||
|
|
3
third_party/python/Modules/_threadmodule.c
vendored
3
third_party/python/Modules/_threadmodule.c
vendored
|
@ -58,8 +58,7 @@
|
|||
#include "libc/sysv/consts/w.h"
|
||||
#include "libc/sysv/consts/waitid.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
#include "libc/time/struct/utimbuf.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "third_party/musl/lockf.h"
|
||||
#include "third_party/musl/passwd.h"
|
||||
|
|
2
third_party/python/Modules/expat/xmlparse.c
vendored
2
third_party/python/Modules/expat/xmlparse.c
vendored
|
@ -11,7 +11,7 @@
|
|||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/grnd.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/python/Modules/expat/expat.h"
|
||||
#include "third_party/python/Modules/expat/expat_config.h"
|
||||
/* f2d0ab6d1d4422a08cf1cf3bbdfba96b49dea42fb5ff4615e03a2a25c306e769 (2.2.8+)
|
||||
|
|
4
third_party/python/Modules/posixmodule.c
vendored
4
third_party/python/Modules/posixmodule.c
vendored
|
@ -61,8 +61,8 @@
|
|||
#include "libc/sysv/consts/w.h"
|
||||
#include "libc/sysv/consts/waitid.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
#include "libc/time/struct/utimbuf.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/utime.h"
|
||||
#include "libc/time.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "third_party/musl/lockf.h"
|
||||
#include "third_party/musl/passwd.h"
|
||||
|
|
2
third_party/python/Modules/signalmodule.c
vendored
2
third_party/python/Modules/signalmodule.c
vendored
|
@ -13,7 +13,7 @@
|
|||
#include "libc/sysv/consts/itimer.h"
|
||||
#include "libc/sysv/consts/sig.h"
|
||||
#include "libc/thread/thread.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/ceval.h"
|
||||
#include "third_party/python/Include/dictobject.h"
|
||||
|
|
3
third_party/python/Modules/timemodule.c
vendored
3
third_party/python/Modules/timemodule.c
vendored
|
@ -17,8 +17,7 @@
|
|||
#include "libc/sock/select.h"
|
||||
#include "libc/sysv/consts/clock.h"
|
||||
#include "libc/sysv/consts/rusage.h"
|
||||
#include "libc/time/struct/tm.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/ceval.h"
|
||||
|
|
2
third_party/python/Modules/xxsubtype.c
vendored
2
third_party/python/Modules/xxsubtype.c
vendored
|
@ -5,7 +5,7 @@
|
|||
│ https://docs.python.org/3/license.html │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/python/Include/descrobject.h"
|
||||
#include "third_party/python/Include/dictobject.h"
|
||||
#include "third_party/python/Include/floatobject.h"
|
||||
|
|
3
third_party/python/Modules/zipimport.c
vendored
3
third_party/python/Modules/zipimport.c
vendored
|
@ -7,8 +7,7 @@
|
|||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/sysv/consts/s.h"
|
||||
#include "libc/time/struct/tm.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/bytesobject.h"
|
||||
|
|
2
third_party/python/Python/condvar.h
vendored
2
third_party/python/Python/condvar.h
vendored
|
@ -1,6 +1,6 @@
|
|||
#ifndef _CONDVAR_H_
|
||||
#define _CONDVAR_H_
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
|
||||
/*
|
||||
* Portable condition variable support for windows and pthreads.
|
||||
|
|
2
third_party/python/Python/pytime.c
vendored
2
third_party/python/Python/pytime.c
vendored
|
@ -9,7 +9,7 @@
|
|||
#include "libc/math.h"
|
||||
#include "libc/nt/synchronization.h"
|
||||
#include "libc/sysv/consts/clock.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/python/Include/floatobject.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
#include "third_party/python/Include/object.h"
|
||||
|
|
2
third_party/python/pyobj.c
vendored
2
third_party/python/pyobj.c
vendored
|
@ -33,7 +33,7 @@
|
|||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/sysv/consts/clock.h"
|
||||
#include "libc/sysv/consts/o.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "libc/zip.internal.h"
|
||||
#include "third_party/getopt/getopt.internal.h"
|
||||
|
|
2
third_party/python/runpythonmodule.c
vendored
2
third_party/python/runpythonmodule.c
vendored
|
@ -27,7 +27,7 @@
|
|||
#include "libc/sysv/consts/fileno.h"
|
||||
#include "libc/sysv/consts/prot.h"
|
||||
#include "libc/sysv/consts/sig.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "libc/x/xasprintf.h"
|
||||
#include "third_party/linenoise/linenoise.h"
|
||||
|
|
4
third_party/sed/compile.c
vendored
4
third_party/sed/compile.c
vendored
|
@ -47,7 +47,7 @@
|
|||
#include "libc/sysv/consts/s.h"
|
||||
#include "libc/sysv/consts/utime.h"
|
||||
#include "libc/mem/gc.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/log/bsd.h"
|
||||
|
@ -74,7 +74,7 @@
|
|||
#include "libc/mem/alg.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
|
||||
#include "third_party/sed/defs.h"
|
||||
#include "third_party/sed/extern.h"
|
||||
|
|
2
third_party/smallz4/smallz4.cc
vendored
2
third_party/smallz4/smallz4.cc
vendored
|
@ -30,7 +30,7 @@
|
|||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/smallz4/smallz4.hh"
|
||||
|
||||
/// error handler
|
||||
|
|
2
third_party/sqlite3/BUILD.mk
vendored
2
third_party/sqlite3/BUILD.mk
vendored
|
@ -55,12 +55,12 @@ THIRD_PARTY_SQLITE3_A_DIRECTDEPS = \
|
|||
LIBC_SYSV \
|
||||
LIBC_SYSV_CALLS \
|
||||
LIBC_THREAD \
|
||||
LIBC_TIME \
|
||||
LIBC_TINYMATH \
|
||||
THIRD_PARTY_COMPILER_RT \
|
||||
THIRD_PARTY_GDTOA \
|
||||
THIRD_PARTY_LINENOISE \
|
||||
THIRD_PARTY_MUSL \
|
||||
THIRD_PARTY_TZ \
|
||||
THIRD_PARTY_ZLIB \
|
||||
TOOL_ARGS
|
||||
|
||||
|
|
3
third_party/sqlite3/date.c
vendored
3
third_party/sqlite3/date.c
vendored
|
@ -46,8 +46,7 @@
|
|||
#include "libc/assert.h"
|
||||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/time/struct/tm.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/sqlite3/sqliteInt.h"
|
||||
|
||||
#ifndef SQLITE_OMIT_DATETIME_FUNCS
|
||||
|
|
2
third_party/sqlite3/fileio.c
vendored
2
third_party/sqlite3/fileio.c
vendored
|
@ -85,7 +85,7 @@
|
|||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/at.h"
|
||||
#include "libc/sysv/consts/s.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/sqlite3/sqlite3ext.h"
|
||||
|
||||
SQLITE_EXTENSION_INIT1
|
||||
|
|
5
third_party/sqlite3/os_unix.c
vendored
5
third_party/sqlite3/os_unix.c
vendored
|
@ -106,8 +106,7 @@
|
|||
#include "libc/sysv/consts/o.h"
|
||||
#include "libc/sysv/consts/ok.h"
|
||||
#include "libc/sysv/consts/prot.h"
|
||||
#include "libc/time/struct/tm.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "libc/mem/mem.h"
|
||||
|
||||
#if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0
|
||||
|
@ -164,7 +163,7 @@
|
|||
#endif /* OS_VXWORKS */
|
||||
|
||||
#ifdef HAVE_UTIME
|
||||
# include "libc/time/time.h"
|
||||
# include "libc/time.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
2
third_party/sqlite3/shell.c
vendored
2
third_party/sqlite3/shell.c
vendored
|
@ -309,7 +309,7 @@ static sqlite3_int64 timeOfDay(void){
|
|||
}
|
||||
|
||||
#if !defined(_WIN32) && !defined(WIN32) && !defined(__minux)
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
|
||||
/* Saved resource information for the beginning of an operation */
|
||||
static struct rusage sBegin; /* CPU time at start */
|
||||
|
|
2
third_party/tidy/tidy-int.h
vendored
2
third_party/tidy/tidy-int.h
vendored
|
@ -16,7 +16,7 @@
|
|||
#include "third_party/tidy/pprint.h"
|
||||
#include "third_party/tidy/access.h"
|
||||
#include "third_party/tidy/message.h"
|
||||
#include "libc/time/struct/utimbuf.h"
|
||||
#include "libc/utime.h"
|
||||
#include "third_party/tidy/parser.h"
|
||||
|
||||
#ifndef MAX
|
||||
|
|
2
third_party/tidy/tidylib.c
vendored
2
third_party/tidy/tidylib.c
vendored
|
@ -37,7 +37,7 @@
|
|||
#include "libc/errno.h"
|
||||
#include "libc/calls/struct/stat.h"
|
||||
#include "libc/sysv/consts/s.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/tidy/sprtf.h"
|
||||
|
||||
/* Create/Destroy a Tidy "document" object */
|
||||
|
|
4
third_party/tree/BUILD.mk
vendored
4
third_party/tree/BUILD.mk
vendored
|
@ -21,8 +21,8 @@ THIRD_PARTY_TREE_A_DIRECTDEPS = \
|
|||
LIBC_STDIO \
|
||||
LIBC_STR \
|
||||
LIBC_SYSV \
|
||||
LIBC_TIME \
|
||||
THIRD_PARTY_MUSL
|
||||
THIRD_PARTY_MUSL \
|
||||
THIRD_PARTY_TZ
|
||||
|
||||
THIRD_PARTY_TREE_A_DEPS := \
|
||||
$(call uniq,$(foreach x,$(THIRD_PARTY_TREE_A_DIRECTDEPS),$($(x))))
|
||||
|
|
434
third_party/tz/BUILD.mk
vendored
Normal file
434
third_party/tz/BUILD.mk
vendored
Normal file
|
@ -0,0 +1,434 @@
|
|||
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐
|
||||
#── vi: set noet ft=make ts=8 sw=8 fenc=utf-8 :vi ────────────────────┘
|
||||
|
||||
PKGS += THIRD_PARTY_TZ
|
||||
|
||||
THIRD_PARTY_TZ_ARTIFACTS += THIRD_PARTY_TZ_A
|
||||
THIRD_PARTY_TZ = $(THIRD_PARTY_TZ_A_DEPS) $(THIRD_PARTY_TZ_A)
|
||||
THIRD_PARTY_TZ_A = o/$(MODE)/third_party/tz/tz.a
|
||||
THIRD_PARTY_TZ_A_FILES := $(wildcard third_party/tz/*)
|
||||
THIRD_PARTY_TZ_A_HDRS = $(filter %.h,$(THIRD_PARTY_TZ_A_FILES))
|
||||
THIRD_PARTY_TZ_A_SRCS = $(filter %.c,$(THIRD_PARTY_TZ_A_FILES))
|
||||
|
||||
LIBC_TIME_ZONEINFOS := \
|
||||
usr/share/zoneinfo/ \
|
||||
usr/share/zoneinfo/CET \
|
||||
usr/share/zoneinfo/CST6CDT \
|
||||
usr/share/zoneinfo/EET \
|
||||
usr/share/zoneinfo/EST \
|
||||
usr/share/zoneinfo/EST5EDT \
|
||||
usr/share/zoneinfo/Factory \
|
||||
usr/share/zoneinfo/GMT \
|
||||
usr/share/zoneinfo/HST \
|
||||
usr/share/zoneinfo/MET \
|
||||
usr/share/zoneinfo/MST \
|
||||
usr/share/zoneinfo/MST7MDT \
|
||||
usr/share/zoneinfo/PST8PDT \
|
||||
usr/share/zoneinfo/WET \
|
||||
usr/share/zoneinfo/Antarctica/ \
|
||||
usr/share/zoneinfo/Antarctica/Casey \
|
||||
usr/share/zoneinfo/Antarctica/Davis \
|
||||
usr/share/zoneinfo/Antarctica/Macquarie \
|
||||
usr/share/zoneinfo/Antarctica/Mawson \
|
||||
usr/share/zoneinfo/Antarctica/Palmer \
|
||||
usr/share/zoneinfo/Antarctica/Rothera \
|
||||
usr/share/zoneinfo/Antarctica/Troll \
|
||||
usr/share/zoneinfo/Antarctica/Vostok \
|
||||
usr/share/zoneinfo/Europe/ \
|
||||
usr/share/zoneinfo/Europe/Andorra \
|
||||
usr/share/zoneinfo/Europe/Astrakhan \
|
||||
usr/share/zoneinfo/Europe/Athens \
|
||||
usr/share/zoneinfo/Europe/Belgrade \
|
||||
usr/share/zoneinfo/Europe/Berlin \
|
||||
usr/share/zoneinfo/Europe/Brussels \
|
||||
usr/share/zoneinfo/Europe/Bucharest \
|
||||
usr/share/zoneinfo/Europe/Budapest \
|
||||
usr/share/zoneinfo/Europe/Chisinau \
|
||||
usr/share/zoneinfo/Europe/Dublin \
|
||||
usr/share/zoneinfo/Europe/Gibraltar \
|
||||
usr/share/zoneinfo/Europe/Helsinki \
|
||||
usr/share/zoneinfo/Europe/Istanbul \
|
||||
usr/share/zoneinfo/Europe/Kaliningrad \
|
||||
usr/share/zoneinfo/Europe/Kirov \
|
||||
usr/share/zoneinfo/Europe/Kyiv \
|
||||
usr/share/zoneinfo/Europe/Lisbon \
|
||||
usr/share/zoneinfo/Europe/London \
|
||||
usr/share/zoneinfo/Europe/Madrid \
|
||||
usr/share/zoneinfo/Europe/Malta \
|
||||
usr/share/zoneinfo/Europe/Minsk \
|
||||
usr/share/zoneinfo/Europe/Moscow \
|
||||
usr/share/zoneinfo/Europe/Paris \
|
||||
usr/share/zoneinfo/Europe/Prague \
|
||||
usr/share/zoneinfo/Europe/Riga \
|
||||
usr/share/zoneinfo/Europe/Rome \
|
||||
usr/share/zoneinfo/Europe/Samara \
|
||||
usr/share/zoneinfo/Europe/Saratov \
|
||||
usr/share/zoneinfo/Europe/Simferopol \
|
||||
usr/share/zoneinfo/Europe/Sofia \
|
||||
usr/share/zoneinfo/Europe/Tallinn \
|
||||
usr/share/zoneinfo/Europe/Tirane \
|
||||
usr/share/zoneinfo/Europe/Ulyanovsk \
|
||||
usr/share/zoneinfo/Europe/Vienna \
|
||||
usr/share/zoneinfo/Europe/Vilnius \
|
||||
usr/share/zoneinfo/Europe/Volgograd \
|
||||
usr/share/zoneinfo/Europe/Warsaw \
|
||||
usr/share/zoneinfo/Europe/Zurich \
|
||||
usr/share/zoneinfo/Asia/ \
|
||||
usr/share/zoneinfo/Asia/Almaty \
|
||||
usr/share/zoneinfo/Asia/Amman \
|
||||
usr/share/zoneinfo/Asia/Anadyr \
|
||||
usr/share/zoneinfo/Asia/Aqtau \
|
||||
usr/share/zoneinfo/Asia/Aqtobe \
|
||||
usr/share/zoneinfo/Asia/Ashgabat \
|
||||
usr/share/zoneinfo/Asia/Atyrau \
|
||||
usr/share/zoneinfo/Asia/Baghdad \
|
||||
usr/share/zoneinfo/Asia/Baku \
|
||||
usr/share/zoneinfo/Asia/Bangkok \
|
||||
usr/share/zoneinfo/Asia/Barnaul \
|
||||
usr/share/zoneinfo/Asia/Beirut \
|
||||
usr/share/zoneinfo/Asia/Bishkek \
|
||||
usr/share/zoneinfo/Asia/Chita \
|
||||
usr/share/zoneinfo/Asia/Choibalsan \
|
||||
usr/share/zoneinfo/Asia/Colombo \
|
||||
usr/share/zoneinfo/Asia/Damascus \
|
||||
usr/share/zoneinfo/Asia/Dhaka \
|
||||
usr/share/zoneinfo/Asia/Dili \
|
||||
usr/share/zoneinfo/Asia/Dubai \
|
||||
usr/share/zoneinfo/Asia/Dushanbe \
|
||||
usr/share/zoneinfo/Asia/Famagusta \
|
||||
usr/share/zoneinfo/Asia/Gaza \
|
||||
usr/share/zoneinfo/Asia/Hebron \
|
||||
usr/share/zoneinfo/Asia/Ho_Chi_Minh \
|
||||
usr/share/zoneinfo/Asia/Hong_Kong \
|
||||
usr/share/zoneinfo/Asia/Hovd \
|
||||
usr/share/zoneinfo/Asia/Irkutsk \
|
||||
usr/share/zoneinfo/Asia/Jakarta \
|
||||
usr/share/zoneinfo/Asia/Jayapura \
|
||||
usr/share/zoneinfo/Asia/Jerusalem \
|
||||
usr/share/zoneinfo/Asia/Kabul \
|
||||
usr/share/zoneinfo/Asia/Kamchatka \
|
||||
usr/share/zoneinfo/Asia/Karachi \
|
||||
usr/share/zoneinfo/Asia/Kathmandu \
|
||||
usr/share/zoneinfo/Asia/Khandyga \
|
||||
usr/share/zoneinfo/Asia/Kolkata \
|
||||
usr/share/zoneinfo/Asia/Krasnoyarsk \
|
||||
usr/share/zoneinfo/Asia/Kuching \
|
||||
usr/share/zoneinfo/Asia/Macau \
|
||||
usr/share/zoneinfo/Asia/Magadan \
|
||||
usr/share/zoneinfo/Asia/Makassar \
|
||||
usr/share/zoneinfo/Asia/Manila \
|
||||
usr/share/zoneinfo/Asia/Nicosia \
|
||||
usr/share/zoneinfo/Asia/Novokuznetsk \
|
||||
usr/share/zoneinfo/Asia/Novosibirsk \
|
||||
usr/share/zoneinfo/Asia/Omsk \
|
||||
usr/share/zoneinfo/Asia/Oral \
|
||||
usr/share/zoneinfo/Asia/Pontianak \
|
||||
usr/share/zoneinfo/Asia/Pyongyang \
|
||||
usr/share/zoneinfo/Asia/Qatar \
|
||||
usr/share/zoneinfo/Asia/Qostanay \
|
||||
usr/share/zoneinfo/Asia/Qyzylorda \
|
||||
usr/share/zoneinfo/Asia/Riyadh \
|
||||
usr/share/zoneinfo/Asia/Sakhalin \
|
||||
usr/share/zoneinfo/Asia/Samarkand \
|
||||
usr/share/zoneinfo/Asia/Seoul \
|
||||
usr/share/zoneinfo/Asia/Shanghai \
|
||||
usr/share/zoneinfo/Asia/Singapore \
|
||||
usr/share/zoneinfo/Asia/Srednekolymsk \
|
||||
usr/share/zoneinfo/Asia/Taipei \
|
||||
usr/share/zoneinfo/Asia/Tashkent \
|
||||
usr/share/zoneinfo/Asia/Tbilisi \
|
||||
usr/share/zoneinfo/Asia/Tehran \
|
||||
usr/share/zoneinfo/Asia/Thimphu \
|
||||
usr/share/zoneinfo/Asia/Tokyo \
|
||||
usr/share/zoneinfo/Asia/Tomsk \
|
||||
usr/share/zoneinfo/Asia/Ulaanbaatar \
|
||||
usr/share/zoneinfo/Asia/Urumqi \
|
||||
usr/share/zoneinfo/Asia/Ust-Nera \
|
||||
usr/share/zoneinfo/Asia/Vladivostok \
|
||||
usr/share/zoneinfo/Asia/Yakutsk \
|
||||
usr/share/zoneinfo/Asia/Yangon \
|
||||
usr/share/zoneinfo/Asia/Yekaterinburg \
|
||||
usr/share/zoneinfo/Asia/Yerevan \
|
||||
usr/share/zoneinfo/Pacific/ \
|
||||
usr/share/zoneinfo/Pacific/Apia \
|
||||
usr/share/zoneinfo/Pacific/Auckland \
|
||||
usr/share/zoneinfo/Pacific/Bougainville \
|
||||
usr/share/zoneinfo/Pacific/Chatham \
|
||||
usr/share/zoneinfo/Pacific/Easter \
|
||||
usr/share/zoneinfo/Pacific/Efate \
|
||||
usr/share/zoneinfo/Pacific/Fakaofo \
|
||||
usr/share/zoneinfo/Pacific/Fiji \
|
||||
usr/share/zoneinfo/Pacific/Galapagos \
|
||||
usr/share/zoneinfo/Pacific/Gambier \
|
||||
usr/share/zoneinfo/Pacific/Guadalcanal \
|
||||
usr/share/zoneinfo/Pacific/Guam \
|
||||
usr/share/zoneinfo/Pacific/Honolulu \
|
||||
usr/share/zoneinfo/Pacific/Kanton \
|
||||
usr/share/zoneinfo/Pacific/Kiritimati \
|
||||
usr/share/zoneinfo/Pacific/Kosrae \
|
||||
usr/share/zoneinfo/Pacific/Kwajalein \
|
||||
usr/share/zoneinfo/Pacific/Marquesas \
|
||||
usr/share/zoneinfo/Pacific/Nauru \
|
||||
usr/share/zoneinfo/Pacific/Niue \
|
||||
usr/share/zoneinfo/Pacific/Norfolk \
|
||||
usr/share/zoneinfo/Pacific/Noumea \
|
||||
usr/share/zoneinfo/Pacific/Pago_Pago \
|
||||
usr/share/zoneinfo/Pacific/Palau \
|
||||
usr/share/zoneinfo/Pacific/Pitcairn \
|
||||
usr/share/zoneinfo/Pacific/Port_Moresby \
|
||||
usr/share/zoneinfo/Pacific/Rarotonga \
|
||||
usr/share/zoneinfo/Pacific/Tahiti \
|
||||
usr/share/zoneinfo/Pacific/Tarawa \
|
||||
usr/share/zoneinfo/Pacific/Tongatapu \
|
||||
usr/share/zoneinfo/America/ \
|
||||
usr/share/zoneinfo/America/Adak \
|
||||
usr/share/zoneinfo/America/Anchorage \
|
||||
usr/share/zoneinfo/America/Araguaina \
|
||||
usr/share/zoneinfo/America/Argentina/ \
|
||||
usr/share/zoneinfo/America/Argentina/Buenos_Aires \
|
||||
usr/share/zoneinfo/America/Argentina/Catamarca \
|
||||
usr/share/zoneinfo/America/Argentina/Cordoba \
|
||||
usr/share/zoneinfo/America/Argentina/Jujuy \
|
||||
usr/share/zoneinfo/America/Argentina/La_Rioja \
|
||||
usr/share/zoneinfo/America/Argentina/Mendoza \
|
||||
usr/share/zoneinfo/America/Argentina/Rio_Gallegos \
|
||||
usr/share/zoneinfo/America/Argentina/Salta \
|
||||
usr/share/zoneinfo/America/Argentina/San_Juan \
|
||||
usr/share/zoneinfo/America/Argentina/San_Luis \
|
||||
usr/share/zoneinfo/America/Argentina/Tucuman \
|
||||
usr/share/zoneinfo/America/Argentina/Ushuaia \
|
||||
usr/share/zoneinfo/America/Asuncion \
|
||||
usr/share/zoneinfo/America/Bahia \
|
||||
usr/share/zoneinfo/America/Bahia_Banderas \
|
||||
usr/share/zoneinfo/America/Barbados \
|
||||
usr/share/zoneinfo/America/Belem \
|
||||
usr/share/zoneinfo/America/Belize \
|
||||
usr/share/zoneinfo/America/Boa_Vista \
|
||||
usr/share/zoneinfo/America/Bogota \
|
||||
usr/share/zoneinfo/America/Boise \
|
||||
usr/share/zoneinfo/America/Cambridge_Bay \
|
||||
usr/share/zoneinfo/America/Campo_Grande \
|
||||
usr/share/zoneinfo/America/Cancun \
|
||||
usr/share/zoneinfo/America/Caracas \
|
||||
usr/share/zoneinfo/America/Cayenne \
|
||||
usr/share/zoneinfo/America/Chicago \
|
||||
usr/share/zoneinfo/America/Chihuahua \
|
||||
usr/share/zoneinfo/America/Ciudad_Juarez \
|
||||
usr/share/zoneinfo/America/Costa_Rica \
|
||||
usr/share/zoneinfo/America/Cuiaba \
|
||||
usr/share/zoneinfo/America/Danmarkshavn \
|
||||
usr/share/zoneinfo/America/Dawson \
|
||||
usr/share/zoneinfo/America/Dawson_Creek \
|
||||
usr/share/zoneinfo/America/Denver \
|
||||
usr/share/zoneinfo/America/Detroit \
|
||||
usr/share/zoneinfo/America/Edmonton \
|
||||
usr/share/zoneinfo/America/Eirunepe \
|
||||
usr/share/zoneinfo/America/El_Salvador \
|
||||
usr/share/zoneinfo/America/Fort_Nelson \
|
||||
usr/share/zoneinfo/America/Fortaleza \
|
||||
usr/share/zoneinfo/America/Glace_Bay \
|
||||
usr/share/zoneinfo/America/Goose_Bay \
|
||||
usr/share/zoneinfo/America/Grand_Turk \
|
||||
usr/share/zoneinfo/America/Guatemala \
|
||||
usr/share/zoneinfo/America/Guayaquil \
|
||||
usr/share/zoneinfo/America/Guyana \
|
||||
usr/share/zoneinfo/America/Halifax \
|
||||
usr/share/zoneinfo/America/Havana \
|
||||
usr/share/zoneinfo/America/Hermosillo \
|
||||
usr/share/zoneinfo/America/Indiana/ \
|
||||
usr/share/zoneinfo/America/Indiana/Indianapolis \
|
||||
usr/share/zoneinfo/America/Indiana/Knox \
|
||||
usr/share/zoneinfo/America/Indiana/Marengo \
|
||||
usr/share/zoneinfo/America/Indiana/Petersburg \
|
||||
usr/share/zoneinfo/America/Indiana/Tell_City \
|
||||
usr/share/zoneinfo/America/Indiana/Vevay \
|
||||
usr/share/zoneinfo/America/Indiana/Vincennes \
|
||||
usr/share/zoneinfo/America/Indiana/Winamac \
|
||||
usr/share/zoneinfo/America/Inuvik \
|
||||
usr/share/zoneinfo/America/Iqaluit \
|
||||
usr/share/zoneinfo/America/Jamaica \
|
||||
usr/share/zoneinfo/America/Juneau \
|
||||
usr/share/zoneinfo/America/Kentucky/ \
|
||||
usr/share/zoneinfo/America/Kentucky/Louisville \
|
||||
usr/share/zoneinfo/America/Kentucky/Monticello \
|
||||
usr/share/zoneinfo/America/La_Paz \
|
||||
usr/share/zoneinfo/America/Lima \
|
||||
usr/share/zoneinfo/America/Los_Angeles \
|
||||
usr/share/zoneinfo/America/Maceio \
|
||||
usr/share/zoneinfo/America/Managua \
|
||||
usr/share/zoneinfo/America/Manaus \
|
||||
usr/share/zoneinfo/America/Martinique \
|
||||
usr/share/zoneinfo/America/Matamoros \
|
||||
usr/share/zoneinfo/America/Mazatlan \
|
||||
usr/share/zoneinfo/America/Menominee \
|
||||
usr/share/zoneinfo/America/Merida \
|
||||
usr/share/zoneinfo/America/Metlakatla \
|
||||
usr/share/zoneinfo/America/Mexico_City \
|
||||
usr/share/zoneinfo/America/Miquelon \
|
||||
usr/share/zoneinfo/America/Moncton \
|
||||
usr/share/zoneinfo/America/Monterrey \
|
||||
usr/share/zoneinfo/America/Montevideo \
|
||||
usr/share/zoneinfo/America/New_York \
|
||||
usr/share/zoneinfo/America/Nome \
|
||||
usr/share/zoneinfo/America/Noronha \
|
||||
usr/share/zoneinfo/America/North_Dakota/ \
|
||||
usr/share/zoneinfo/America/North_Dakota/Beulah \
|
||||
usr/share/zoneinfo/America/North_Dakota/Center \
|
||||
usr/share/zoneinfo/America/North_Dakota/New_Salem \
|
||||
usr/share/zoneinfo/America/Nuuk \
|
||||
usr/share/zoneinfo/America/Ojinaga \
|
||||
usr/share/zoneinfo/America/Panama \
|
||||
usr/share/zoneinfo/America/Paramaribo \
|
||||
usr/share/zoneinfo/America/Phoenix \
|
||||
usr/share/zoneinfo/America/Port-au-Prince \
|
||||
usr/share/zoneinfo/America/Porto_Velho \
|
||||
usr/share/zoneinfo/America/Puerto_Rico \
|
||||
usr/share/zoneinfo/America/Punta_Arenas \
|
||||
usr/share/zoneinfo/America/Rankin_Inlet \
|
||||
usr/share/zoneinfo/America/Recife \
|
||||
usr/share/zoneinfo/America/Regina \
|
||||
usr/share/zoneinfo/America/Resolute \
|
||||
usr/share/zoneinfo/America/Rio_Branco \
|
||||
usr/share/zoneinfo/America/Santarem \
|
||||
usr/share/zoneinfo/America/Santiago \
|
||||
usr/share/zoneinfo/America/Santo_Domingo \
|
||||
usr/share/zoneinfo/America/Sao_Paulo \
|
||||
usr/share/zoneinfo/America/Scoresbysund \
|
||||
usr/share/zoneinfo/America/Sitka \
|
||||
usr/share/zoneinfo/America/St_Johns \
|
||||
usr/share/zoneinfo/America/Swift_Current \
|
||||
usr/share/zoneinfo/America/Tegucigalpa \
|
||||
usr/share/zoneinfo/America/Thule \
|
||||
usr/share/zoneinfo/America/Tijuana \
|
||||
usr/share/zoneinfo/America/Toronto \
|
||||
usr/share/zoneinfo/America/Vancouver \
|
||||
usr/share/zoneinfo/America/Whitehorse \
|
||||
usr/share/zoneinfo/America/Winnipeg \
|
||||
usr/share/zoneinfo/America/Yakutat \
|
||||
usr/share/zoneinfo/Africa/ \
|
||||
usr/share/zoneinfo/Africa/Abidjan \
|
||||
usr/share/zoneinfo/Africa/Algiers \
|
||||
usr/share/zoneinfo/Africa/Bissau \
|
||||
usr/share/zoneinfo/Africa/Cairo \
|
||||
usr/share/zoneinfo/Africa/Casablanca \
|
||||
usr/share/zoneinfo/Africa/Ceuta \
|
||||
usr/share/zoneinfo/Africa/El_Aaiun \
|
||||
usr/share/zoneinfo/Africa/Johannesburg \
|
||||
usr/share/zoneinfo/Africa/Juba \
|
||||
usr/share/zoneinfo/Africa/Khartoum \
|
||||
usr/share/zoneinfo/Africa/Lagos \
|
||||
usr/share/zoneinfo/Africa/Maputo \
|
||||
usr/share/zoneinfo/Africa/Monrovia \
|
||||
usr/share/zoneinfo/Africa/Nairobi \
|
||||
usr/share/zoneinfo/Africa/Ndjamena \
|
||||
usr/share/zoneinfo/Africa/Sao_Tome \
|
||||
usr/share/zoneinfo/Africa/Tripoli \
|
||||
usr/share/zoneinfo/Africa/Tunis \
|
||||
usr/share/zoneinfo/Africa/Windhoek \
|
||||
usr/share/zoneinfo/Australia/ \
|
||||
usr/share/zoneinfo/Australia/Adelaide \
|
||||
usr/share/zoneinfo/Australia/Brisbane \
|
||||
usr/share/zoneinfo/Australia/Broken_Hill \
|
||||
usr/share/zoneinfo/Australia/Darwin \
|
||||
usr/share/zoneinfo/Australia/Eucla \
|
||||
usr/share/zoneinfo/Australia/Hobart \
|
||||
usr/share/zoneinfo/Australia/Lindeman \
|
||||
usr/share/zoneinfo/Australia/Lord_Howe \
|
||||
usr/share/zoneinfo/Australia/Melbourne \
|
||||
usr/share/zoneinfo/Australia/Perth \
|
||||
usr/share/zoneinfo/Australia/Sydney \
|
||||
usr/share/zoneinfo/Atlantic/ \
|
||||
usr/share/zoneinfo/Atlantic/Azores \
|
||||
usr/share/zoneinfo/Atlantic/Bermuda \
|
||||
usr/share/zoneinfo/Atlantic/Canary \
|
||||
usr/share/zoneinfo/Atlantic/Cape_Verde \
|
||||
usr/share/zoneinfo/Atlantic/Faroe \
|
||||
usr/share/zoneinfo/Atlantic/Madeira \
|
||||
usr/share/zoneinfo/Atlantic/South_Georgia \
|
||||
usr/share/zoneinfo/Atlantic/Stanley \
|
||||
usr/share/zoneinfo/Etc/ \
|
||||
usr/share/zoneinfo/Etc/UTC \
|
||||
usr/share/zoneinfo/Etc/GMT-14 \
|
||||
usr/share/zoneinfo/Etc/GMT-13 \
|
||||
usr/share/zoneinfo/Etc/GMT-12 \
|
||||
usr/share/zoneinfo/Etc/GMT-11 \
|
||||
usr/share/zoneinfo/Etc/GMT-10 \
|
||||
usr/share/zoneinfo/Etc/GMT-9 \
|
||||
usr/share/zoneinfo/Etc/GMT-8 \
|
||||
usr/share/zoneinfo/Etc/GMT-7 \
|
||||
usr/share/zoneinfo/Etc/GMT-6 \
|
||||
usr/share/zoneinfo/Etc/GMT-5 \
|
||||
usr/share/zoneinfo/Etc/GMT-4 \
|
||||
usr/share/zoneinfo/Etc/GMT-3 \
|
||||
usr/share/zoneinfo/Etc/GMT-2 \
|
||||
usr/share/zoneinfo/Etc/GMT-1 \
|
||||
usr/share/zoneinfo/Etc/GMT \
|
||||
usr/share/zoneinfo/Etc/GMT+1 \
|
||||
usr/share/zoneinfo/Etc/GMT+2 \
|
||||
usr/share/zoneinfo/Etc/GMT+3 \
|
||||
usr/share/zoneinfo/Etc/GMT+4 \
|
||||
usr/share/zoneinfo/Etc/GMT+5 \
|
||||
usr/share/zoneinfo/Etc/GMT+6 \
|
||||
usr/share/zoneinfo/Etc/GMT+7 \
|
||||
usr/share/zoneinfo/Etc/GMT+8 \
|
||||
usr/share/zoneinfo/Etc/GMT+9 \
|
||||
usr/share/zoneinfo/Etc/GMT+10 \
|
||||
usr/share/zoneinfo/Etc/GMT+11 \
|
||||
usr/share/zoneinfo/Etc/GMT+12 \
|
||||
usr/share/zoneinfo/Indian/ \
|
||||
usr/share/zoneinfo/Indian/Chagos \
|
||||
usr/share/zoneinfo/Indian/Maldives \
|
||||
usr/share/zoneinfo/Indian/Mauritius
|
||||
|
||||
THIRD_PARTY_TZ_A_OBJS = \
|
||||
$(THIRD_PARTY_TZ_A_SRCS:%.c=o/$(MODE)/%.o) \
|
||||
$(LIBC_TIME_ZONEINFOS:%=o/$(MODE)/%.zip.o)
|
||||
|
||||
THIRD_PARTY_TZ_A_CHECKS = \
|
||||
$(THIRD_PARTY_TZ_A).pkg \
|
||||
$(THIRD_PARTY_TZ_A_HDRS:%=o/$(MODE)/%.ok)
|
||||
|
||||
THIRD_PARTY_TZ_A_DIRECTDEPS = \
|
||||
LIBC_INTRIN \
|
||||
LIBC_CALLS \
|
||||
LIBC_MEM \
|
||||
LIBC_NEXGEN32E \
|
||||
LIBC_NT_KERNEL32 \
|
||||
LIBC_RUNTIME \
|
||||
LIBC_STDIO \
|
||||
LIBC_STR \
|
||||
LIBC_SYSV
|
||||
|
||||
THIRD_PARTY_TZ_A_DEPS := \
|
||||
$(call uniq,$(foreach x,$(THIRD_PARTY_TZ_A_DIRECTDEPS),$($(x))))
|
||||
|
||||
$(THIRD_PARTY_TZ_A): \
|
||||
third_party/tz/ \
|
||||
$(THIRD_PARTY_TZ_A).pkg \
|
||||
$(THIRD_PARTY_TZ_A_OBJS)
|
||||
|
||||
$(THIRD_PARTY_TZ_A).pkg: \
|
||||
$(THIRD_PARTY_TZ_A_OBJS) \
|
||||
$(foreach x,$(THIRD_PARTY_TZ_A_DIRECTDEPS),$($(x)_A).pkg)
|
||||
|
||||
# make this library tinier
|
||||
o/$(MODE)/third_party/tz/strftime.o: private CFLAGS += -fno-jump-tables
|
||||
o/$(MODE)/third_party/tz/localtime.o: private CFLAGS += -fdata-sections -ffunction-sections
|
||||
|
||||
# offer same stack safety assurances as cosmo libc
|
||||
$(THIRD_PARTY_TZ_A_OBJS): private COPTS += -Wframe-larger-than=4096 -Walloca-larger-than=4096
|
||||
|
||||
o/$(MODE)/usr/share/zoneinfo/.zip.o: usr/share/zoneinfo
|
||||
|
||||
THIRD_PARTY_TZ_LIBS = $(foreach x,$(THIRD_PARTY_TZ_ARTIFACTS),$($(x)))
|
||||
THIRD_PARTY_TZ_SRCS = $(foreach x,$(THIRD_PARTY_TZ_ARTIFACTS),$($(x)_SRCS))
|
||||
THIRD_PARTY_TZ_HDRS = $(foreach x,$(THIRD_PARTY_TZ_ARTIFACTS),$($(x)_HDRS))
|
||||
THIRD_PARTY_TZ_BINS = $(foreach x,$(THIRD_PARTY_TZ_ARTIFACTS),$($(x)_BINS))
|
||||
THIRD_PARTY_TZ_CHECKS = $(foreach x,$(THIRD_PARTY_TZ_ARTIFACTS),$($(x)_CHECKS))
|
||||
THIRD_PARTY_TZ_OBJS = $(foreach x,$(THIRD_PARTY_TZ_ARTIFACTS),$($(x)_OBJS))
|
||||
$(THIRD_PARTY_TZ_OBJS): $(BUILD_FILES) third_party/tz/BUILD.mk
|
||||
|
||||
.PHONY: o/$(MODE)/third_party/tz
|
||||
o/$(MODE)/third_party/tz: \
|
||||
$(THIRD_PARTY_TZ_A) \
|
||||
$(THIRD_PARTY_TZ_CHECKS)
|
5
third_party/tz/LICENSE
vendored
Normal file
5
third_party/tz/LICENSE
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
Unless specified below, all files in the tz code and data (including
|
||||
this LICENSE file) are in the public domain.
|
||||
|
||||
If the files date.c, newstrftime.3, and strftime.c are present, they
|
||||
contain material derived from BSD and use the BSD 3-clause license.
|
25
third_party/tz/README.cosmo
vendored
Normal file
25
third_party/tz/README.cosmo
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
DESCRIPTION
|
||||
|
||||
tz is a library for handling time zones
|
||||
|
||||
LICENSE
|
||||
|
||||
See LICENSE file
|
||||
|
||||
ORIGIN
|
||||
|
||||
git@github.com:eggert/tz.git
|
||||
a75a6251d30b28a7badc1763296205adf67a5081
|
||||
Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
BUILD PROCESS
|
||||
|
||||
make -j8 install BACKWARD= DESTDIR=stage REDO=posix_only
|
||||
|
||||
LOCAL CHANGES
|
||||
|
||||
- Add aliases for legacy Cosmo timezone names.
|
||||
- Add yoinks for embedding time zones in binary.
|
||||
- Make localtime() posix thread cancelation safe.
|
||||
- Improve readabiilty with "localtime_" prefixes.
|
||||
- Automate the TZ environment variable on Windows.
|
135
third_party/tz/asctime.c
vendored
Normal file
135
third_party/tz/asctime.c
vendored
Normal file
|
@ -0,0 +1,135 @@
|
|||
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│
|
||||
│ vi: set noet ft=c ts=8 sw=8 fenc=utf-8 :vi │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "private.h"
|
||||
|
||||
/* asctime and asctime_r a la POSIX and ISO C, except pad years before 1000. */
|
||||
|
||||
/*
|
||||
** This file is in the public domain, so clarified as of
|
||||
** 1996-06-05 by Arthur David Olson.
|
||||
*/
|
||||
|
||||
/*
|
||||
** Avoid the temptation to punt entirely to strftime;
|
||||
** the output of strftime is supposed to be locale specific
|
||||
** whereas the output of asctime is supposed to be constant.
|
||||
*/
|
||||
|
||||
/*LINTLIBRARY*/
|
||||
|
||||
/*
|
||||
** All years associated with 32-bit time_t values are exactly four digits long;
|
||||
** some years associated with 64-bit time_t values are not.
|
||||
** Vintage programs are coded for years that are always four digits long
|
||||
** and may assume that the newline always lands in the same place.
|
||||
** For years that are less than four digits, we pad the output with
|
||||
** leading zeroes to get the newline in the traditional place.
|
||||
** The -4 ensures that we get four characters of output even if
|
||||
** we call a strftime variant that produces fewer characters for some years.
|
||||
** The ISO C and POSIX standards prohibit padding the year,
|
||||
** but many implementations pad anyway; most likely the standards are buggy.
|
||||
*/
|
||||
static char const ASCTIME_FMT[] = "%s %s%3d %.2d:%.2d:%.2d %-4s\n";
|
||||
/*
|
||||
** For years that are more than four digits we put extra spaces before the year
|
||||
** so that code trying to overwrite the newline won't end up overwriting
|
||||
** a digit within a year and truncating the year (operating on the assumption
|
||||
** that no output is better than wrong output).
|
||||
*/
|
||||
static char const ASCTIME_FMT_B[] = "%s %s%3d %.2d:%.2d:%.2d %s\n";
|
||||
|
||||
enum { STD_ASCTIME_BUF_SIZE = 26 };
|
||||
/*
|
||||
** Big enough for something such as
|
||||
** ??? ???-2147483648 -2147483648:-2147483648:-2147483648 -2147483648\n
|
||||
** (two three-character abbreviations, five strings denoting integers,
|
||||
** seven explicit spaces, two explicit colons, a newline,
|
||||
** and a trailing NUL byte).
|
||||
** The values above are for systems where an int is 32 bits and are provided
|
||||
** as an example; the size expression below is a bound for the system at
|
||||
** hand.
|
||||
*/
|
||||
static char buf_asctime[2*3 + 5*INT_STRLEN_MAXIMUM(int) + 7 + 2 + 1 + 1];
|
||||
|
||||
/* A similar buffer for ctime.
|
||||
C89 requires that they be the same buffer.
|
||||
This requirement was removed in C99, so support it only if requested,
|
||||
as support is more likely to lead to bugs in badly written programs. */
|
||||
#if SUPPORT_C89
|
||||
# define buf_ctime buf_asctime
|
||||
#else
|
||||
static char buf_ctime[sizeof buf_asctime];
|
||||
#endif
|
||||
|
||||
char *
|
||||
asctime_r(struct tm const *restrict timeptr, char *restrict buf)
|
||||
{
|
||||
static const char wday_name[][4] = {
|
||||
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
||||
};
|
||||
static const char mon_name[][4] = {
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
||||
};
|
||||
register const char * wn;
|
||||
register const char * mn;
|
||||
char year[INT_STRLEN_MAXIMUM(int) + 2];
|
||||
char result[sizeof buf_asctime];
|
||||
|
||||
if (timeptr == NULL) {
|
||||
errno = EINVAL;
|
||||
return strcpy(buf, "??? ??? ?? ??:??:?? ????\n");
|
||||
}
|
||||
if (timeptr->tm_wday < 0 || timeptr->tm_wday >= DAYSPERWEEK)
|
||||
wn = "???";
|
||||
else wn = wday_name[timeptr->tm_wday];
|
||||
if (timeptr->tm_mon < 0 || timeptr->tm_mon >= MONSPERYEAR)
|
||||
mn = "???";
|
||||
else mn = mon_name[timeptr->tm_mon];
|
||||
/*
|
||||
** Use strftime's %Y to generate the year, to avoid overflow problems
|
||||
** when computing timeptr->tm_year + TM_YEAR_BASE.
|
||||
** Assume that strftime is unaffected by other out-of-range members
|
||||
** (e.g., timeptr->tm_mday) when processing "%Y".
|
||||
*/
|
||||
strftime(year, sizeof year, "%Y", timeptr);
|
||||
/*
|
||||
** We avoid using snprintf since it's not available on all systems.
|
||||
*/
|
||||
sprintf(result,
|
||||
((strlen(year) <= 4) ? ASCTIME_FMT : ASCTIME_FMT_B),
|
||||
wn, mn,
|
||||
timeptr->tm_mday, timeptr->tm_hour,
|
||||
timeptr->tm_min, timeptr->tm_sec,
|
||||
year);
|
||||
if (strlen(result) < STD_ASCTIME_BUF_SIZE
|
||||
|| buf == buf_ctime || buf == buf_asctime)
|
||||
return strcpy(buf, result);
|
||||
else {
|
||||
errno = EOVERFLOW;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
asctime(register const struct tm *timeptr)
|
||||
{
|
||||
return asctime_r(timeptr, buf_asctime);
|
||||
}
|
||||
|
||||
char *
|
||||
ctime_r(const time_t *timep, char *buf)
|
||||
{
|
||||
struct tm mytm;
|
||||
struct tm *tmp = localtime_r(timep, &mytm);
|
||||
return tmp ? asctime_r(tmp, buf) : NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
ctime(const time_t *timep)
|
||||
{
|
||||
return ctime_r(timep, buf_ctime);
|
||||
}
|
22
third_party/tz/ctime.c
vendored
Normal file
22
third_party/tz/ctime.c
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│
|
||||
│ vi: set noet ft=c ts=8 sw=8 fenc=utf-8 :vi │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/time.h"
|
||||
|
||||
/**
|
||||
* Represents time as string.
|
||||
* @threadunsafe
|
||||
*/
|
||||
char *
|
||||
ctime(const time_t *timep)
|
||||
{
|
||||
/*
|
||||
** Section 4.12.3.2 of X3.159-1989 requires that
|
||||
** The ctime function converts the calendar time pointed to by timer
|
||||
** to local time in the form of a string. It is equivalent to
|
||||
** asctime(localtime(timer))
|
||||
*/
|
||||
struct tm *tmp = localtime(timep);
|
||||
return tmp ? asctime(tmp) : NULL;
|
||||
}
|
13
third_party/tz/ctime_r.c
vendored
Normal file
13
third_party/tz/ctime_r.c
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│
|
||||
│ vi: set noet ft=c ts=8 sw=8 fenc=utf-8 :vi │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/time.h"
|
||||
|
||||
char *
|
||||
ctime_r(const time_t *timep, char *buf)
|
||||
{
|
||||
struct tm mytm;
|
||||
struct tm *tmp = localtime_r(timep, &mytm);
|
||||
return tmp ? asctime_r(tmp, buf) : NULL;
|
||||
}
|
6
third_party/tz/daylight.c
vendored
Normal file
6
third_party/tz/daylight.c
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│
|
||||
│ vi: set noet ft=c ts=8 sw=8 fenc=utf-8 :vi │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/time.h"
|
||||
|
||||
int daylight;
|
58
third_party/tz/difftime.c
vendored
Normal file
58
third_party/tz/difftime.c
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│
|
||||
│ vi: set noet ft=c ts=8 sw=8 fenc=utf-8 :vi │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/time.h"
|
||||
|
||||
/* Return the difference between two timestamps. */
|
||||
|
||||
/* Return -X as a double. Using this avoids casting to 'double'. */
|
||||
static double
|
||||
dminus(double x)
|
||||
{
|
||||
return -x;
|
||||
}
|
||||
|
||||
double
|
||||
difftime(time_t time1, time_t time0)
|
||||
{
|
||||
/*
|
||||
** If double is large enough, simply convert and subtract
|
||||
** (assuming that the larger type has more precision).
|
||||
*/
|
||||
if (sizeof(time_t) < sizeof(double)) {
|
||||
double t1 = time1, t0 = time0;
|
||||
return t1 - t0;
|
||||
}
|
||||
|
||||
/*
|
||||
** The difference of two unsigned values can't overflow
|
||||
** if the minuend is greater than or equal to the subtrahend.
|
||||
*/
|
||||
if (!TYPE_SIGNED(time_t))
|
||||
return time0 <= time1 ? time1 - time0 : dminus(time0 - time1);
|
||||
|
||||
/* Use uintmax_t if wide enough. */
|
||||
if (sizeof(time_t) <= sizeof(uintmax_t)) {
|
||||
uintmax_t t1 = time1, t0 = time0;
|
||||
return time0 <= time1 ? t1 - t0 : dminus(t0 - t1);
|
||||
}
|
||||
|
||||
/*
|
||||
** Handle cases where both time1 and time0 have the same sign
|
||||
** (meaning that their difference cannot overflow).
|
||||
*/
|
||||
if ((time1 < 0) == (time0 < 0))
|
||||
return time1 - time0;
|
||||
|
||||
/*
|
||||
** The values have opposite signs and uintmax_t is too narrow.
|
||||
** This suffers from double rounding; attempt to lessen that
|
||||
** by using long double temporaries.
|
||||
*/
|
||||
{
|
||||
long double t1 = time1, t0 = time0;
|
||||
return t1 - t0;
|
||||
}
|
||||
}
|
2890
third_party/tz/localtime.c
vendored
Normal file
2890
third_party/tz/localtime.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
165
third_party/tz/private.h
vendored
Normal file
165
third_party/tz/private.h
vendored
Normal file
|
@ -0,0 +1,165 @@
|
|||
#ifndef TZ_PRIVATE_H
|
||||
#define TZ_PRIVATE_H
|
||||
#include "libc/errno.h"
|
||||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/time.h"
|
||||
#include "libc/limits.h"
|
||||
|
||||
#define ALL_STATE
|
||||
#define HAVE_TZNAME 1
|
||||
#define HAVE_MALLOC_ERRNO 1
|
||||
#define TM_ZONE tm_zone
|
||||
#define TM_GMTOFF tm_gmtoff
|
||||
|
||||
/* The maximum size of any created object, as a signed integer.
|
||||
Although the C standard does not outright prohibit larger objects,
|
||||
behavior is undefined if the result of pointer subtraction does not
|
||||
fit into ptrdiff_t, and the code assumes in several places that
|
||||
pointer subtraction works. As a practical matter it's OK to not
|
||||
support objects larger than this. */
|
||||
#define INDEX_MAX ((ptrdiff_t)min(PTRDIFF_MAX, SIZE_MAX))
|
||||
|
||||
#define ATTRIBUTE_MALLOC __attribute__((__malloc__))
|
||||
#define ATTRIBUTE_FORMAT(spec) __attribute__((__format__ spec))
|
||||
#define ATTRIBUTE_FALLTHROUGH __attribute__((__fallthrough__))
|
||||
#define ATTRIBUTE_MAYBE_UNUSED __attribute__((__unused__))
|
||||
#define ATTRIBUTE_NORETURN __attribute__((__noreturn__))
|
||||
#define ATTRIBUTE_REPRODUCIBLE __attribute__((__pure__))
|
||||
#define ATTRIBUTE_UNSEQUENCED __attribute__((__const__))
|
||||
|
||||
#define unreachable() __builtin_unreachable()
|
||||
|
||||
/*
|
||||
** Finally, some convenience items.
|
||||
*/
|
||||
|
||||
#define TYPE_BIT(type) (CHAR_BIT * (ptrdiff_t)sizeof(type))
|
||||
#define TYPE_SIGNED(type) (((type) - 1) < 0)
|
||||
#define TWOS_COMPLEMENT(t) ((t) ~(t)0 < 0)
|
||||
|
||||
/* Minimum and maximum of two values. Use lower case to avoid
|
||||
naming clashes with standard include files. */
|
||||
#define max(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
/* Max and min values of the integer type T, of which only the bottom
|
||||
B bits are used, and where the highest-order used bit is considered
|
||||
to be a sign bit if T is signed. */
|
||||
#define MAXVAL(t, b) \
|
||||
((t)(((t)1 << ((b) - 1 - TYPE_SIGNED(t))) - 1 + \
|
||||
((t)1 << ((b) - 1 - TYPE_SIGNED(t)))))
|
||||
#define MINVAL(t, b) \
|
||||
((t)(TYPE_SIGNED(t) ? -TWOS_COMPLEMENT(t) - MAXVAL(t, b) : 0))
|
||||
|
||||
/* The extreme time values, assuming no padding. */
|
||||
#define TIME_T_MIN_NO_PADDING MINVAL(time_t, TYPE_BIT(time_t))
|
||||
#define TIME_T_MAX_NO_PADDING MAXVAL(time_t, TYPE_BIT(time_t))
|
||||
|
||||
/*
|
||||
** 302 / 1000 is log10(2.0) rounded up.
|
||||
** Subtract one for the sign bit if the type is signed;
|
||||
** add one for integer division truncation;
|
||||
** add one more for a minus sign if the type is signed.
|
||||
*/
|
||||
#define INT_STRLEN_MAXIMUM(type) \
|
||||
((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + 1 + TYPE_SIGNED(type))
|
||||
|
||||
/*
|
||||
** INITIALIZE(x)
|
||||
*/
|
||||
|
||||
/* Whether memory access must strictly follow the C standard.
|
||||
If 0, it's OK to read uninitialized storage so long as the value is
|
||||
not relied upon. Defining it to 0 lets mktime access parts of
|
||||
struct tm that might be uninitialized, as a heuristic when the
|
||||
standard doesn't say what to return and when tm_gmtoff can help
|
||||
mktime likely infer a better value. */
|
||||
#ifndef UNINIT_TRAP
|
||||
#define UNINIT_TRAP 0
|
||||
#endif
|
||||
|
||||
#if !defined TZ_DOMAIN && defined HAVE_GETTEXT
|
||||
#define TZ_DOMAIN "tz"
|
||||
#endif
|
||||
|
||||
/* Handy macros that are independent of tzfile implementation. */
|
||||
|
||||
enum {
|
||||
SECSPERMIN = 60,
|
||||
MINSPERHOUR = 60,
|
||||
SECSPERHOUR = SECSPERMIN * MINSPERHOUR,
|
||||
HOURSPERDAY = 24,
|
||||
DAYSPERWEEK = 7,
|
||||
DAYSPERNYEAR = 365,
|
||||
DAYSPERLYEAR = DAYSPERNYEAR + 1,
|
||||
MONSPERYEAR = 12,
|
||||
YEARSPERREPEAT = 400 /* years before a Gregorian repeat */
|
||||
};
|
||||
|
||||
#define SECSPERDAY ((int_fast32_t)SECSPERHOUR * HOURSPERDAY)
|
||||
|
||||
#define DAYSPERREPEAT ((int_fast32_t)400 * 365 + 100 - 4 + 1)
|
||||
#define SECSPERREPEAT ((int_fast64_t)DAYSPERREPEAT * SECSPERDAY)
|
||||
#define AVGSECSPERYEAR (SECSPERREPEAT / YEARSPERREPEAT)
|
||||
|
||||
/* How many years to generate (in zic.c) or search through (in localtime.c).
|
||||
This is two years larger than the obvious 400, to avoid edge cases.
|
||||
E.g., suppose a non-POSIX.1-2017 rule applies from 2012 on with transitions
|
||||
in March and September, plus one-off transitions in November 2013.
|
||||
If zic looked only at the last 400 years, it would set max_year=2413,
|
||||
with the intent that the 400 years 2014 through 2413 will be repeated.
|
||||
The last transition listed in the tzfile would be in 2413-09,
|
||||
less than 400 years after the last one-off transition in 2013-11.
|
||||
Two years is not overkill for localtime.c, as a one-year bump
|
||||
would mishandle 2023d's America/Ciudad_Juarez for November 2422. */
|
||||
enum { years_of_observations = YEARSPERREPEAT + 2 };
|
||||
|
||||
enum {
|
||||
TM_SUNDAY,
|
||||
TM_MONDAY,
|
||||
TM_TUESDAY,
|
||||
TM_WEDNESDAY,
|
||||
TM_THURSDAY,
|
||||
TM_FRIDAY,
|
||||
TM_SATURDAY
|
||||
};
|
||||
|
||||
enum {
|
||||
TM_JANUARY,
|
||||
TM_FEBRUARY,
|
||||
TM_MARCH,
|
||||
TM_APRIL,
|
||||
TM_MAY,
|
||||
TM_JUNE,
|
||||
TM_JULY,
|
||||
TM_AUGUST,
|
||||
TM_SEPTEMBER,
|
||||
TM_OCTOBER,
|
||||
TM_NOVEMBER,
|
||||
TM_DECEMBER
|
||||
};
|
||||
|
||||
enum {
|
||||
TM_YEAR_BASE = 1900,
|
||||
TM_WDAY_BASE = TM_MONDAY,
|
||||
EPOCH_YEAR = 1970,
|
||||
EPOCH_WDAY = TM_THURSDAY
|
||||
};
|
||||
|
||||
#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
|
||||
|
||||
/*
|
||||
** Since everything in isleap is modulo 400 (or a factor of 400), we know that
|
||||
** isleap(y) == isleap(y % 400)
|
||||
** and so
|
||||
** isleap(a + b) == isleap((a + b) % 400)
|
||||
** or
|
||||
** isleap(a + b) == isleap(a % 400 + b % 400)
|
||||
** This is true even if % means modulo rather than Fortran remainder
|
||||
** (which is allowed by C89 but not by C99 or later).
|
||||
** We use this to avoid addition overflow problems.
|
||||
*/
|
||||
|
||||
#define isleap_sum(a, b) isleap((a) % 400 + (b) % 400)
|
||||
|
||||
#endif /* !defined TZ_PRIVATE_H */
|
646
third_party/tz/strftime.c
vendored
Normal file
646
third_party/tz/strftime.c
vendored
Normal file
|
@ -0,0 +1,646 @@
|
|||
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│
|
||||
│ vi: set noet ft=c ts=8 sw=8 fenc=utf-8 :vi │
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright (c) 1989 The Regents of the University of California. │
|
||||
│ All rights reserved. │
|
||||
│ │
|
||||
│ Redistribution and use in source and binary forms are permitted │
|
||||
│ provided that the above copyright notice and this paragraph are │
|
||||
│ duplicated in all such forms and that any documentation, │
|
||||
│ advertising materials, and other materials related to such │
|
||||
│ distribution and use acknowledge that the software was developed │
|
||||
│ by the University of California, Berkeley. The name of the │
|
||||
│ University may not 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 "libc/str/locale.h"
|
||||
#include "libc/time.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/inttypes.h"
|
||||
#include "private.h"
|
||||
|
||||
__notice(strftime_notice, "strftime (BSD-3)\n\
|
||||
Copyright 1989 The Regents of the University of California");
|
||||
|
||||
#ifndef DEPRECATE_TWO_DIGIT_YEARS
|
||||
# define DEPRECATE_TWO_DIGIT_YEARS false
|
||||
#endif
|
||||
|
||||
struct lc_time_T {
|
||||
const char * mon[MONSPERYEAR];
|
||||
const char * month[MONSPERYEAR];
|
||||
const char * wday[DAYSPERWEEK];
|
||||
const char * weekday[DAYSPERWEEK];
|
||||
const char * X_fmt;
|
||||
const char * x_fmt;
|
||||
const char * c_fmt;
|
||||
const char * am;
|
||||
const char * pm;
|
||||
const char * date_fmt;
|
||||
};
|
||||
|
||||
static const struct lc_time_T C_time_locale = {
|
||||
{
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
||||
}, {
|
||||
"January", "February", "March", "April", "May", "June",
|
||||
"July", "August", "September", "October", "November", "December"
|
||||
}, {
|
||||
"Sun", "Mon", "Tue", "Wed",
|
||||
"Thu", "Fri", "Sat"
|
||||
}, {
|
||||
"Sunday", "Monday", "Tuesday", "Wednesday",
|
||||
"Thursday", "Friday", "Saturday"
|
||||
},
|
||||
|
||||
/* X_fmt */
|
||||
"%H:%M:%S",
|
||||
|
||||
/*
|
||||
** x_fmt
|
||||
** C99 and later require this format.
|
||||
** Using just numbers (as here) makes Quakers happier;
|
||||
** it's also compatible with SVR4.
|
||||
*/
|
||||
"%m/%d/%y",
|
||||
|
||||
/*
|
||||
** c_fmt
|
||||
** C99 and later require this format.
|
||||
** Previously this code used "%D %X", but we now conform to C99.
|
||||
** Note that
|
||||
** "%a %b %d %H:%M:%S %Y"
|
||||
** is used by Solaris 2.3.
|
||||
*/
|
||||
"%a %b %e %T %Y",
|
||||
|
||||
/* am */
|
||||
"AM",
|
||||
|
||||
/* pm */
|
||||
"PM",
|
||||
|
||||
/* date_fmt */
|
||||
"%a %b %e %H:%M:%S %Z %Y"
|
||||
};
|
||||
|
||||
enum warn { IN_NONE, IN_SOME, IN_THIS, IN_ALL };
|
||||
|
||||
#ifndef YEAR_2000_NAME
|
||||
# define YEAR_2000_NAME "CHECK_STRFTIME_FORMATS_FOR_TWO_DIGIT_YEARS"
|
||||
#endif /* !defined YEAR_2000_NAME */
|
||||
|
||||
static char *
|
||||
_add(const char *str, char *pt, const char *ptlim)
|
||||
{
|
||||
while (pt < ptlim && (*pt = *str++) != '\0')
|
||||
++pt;
|
||||
return pt;
|
||||
}
|
||||
|
||||
static char *
|
||||
_conv(int n, const char *format, char *pt, const char *ptlim)
|
||||
{
|
||||
char buf[INT_STRLEN_MAXIMUM(int) + 1];
|
||||
|
||||
sprintf(buf, format, n);
|
||||
return _add(buf, pt, ptlim);
|
||||
}
|
||||
|
||||
/*
|
||||
** POSIX and the C Standard are unclear or inconsistent about
|
||||
** what %C and %y do if the year is negative or exceeds 9999.
|
||||
** Use the convention that %C concatenated with %y yields the
|
||||
** same output as %Y, and that %Y contains at least 4 bytes,
|
||||
** with more only if necessary.
|
||||
*/
|
||||
|
||||
static char *
|
||||
_yconv(int a, int b, bool convert_top, bool convert_yy,
|
||||
char *pt, const char *ptlim)
|
||||
{
|
||||
register int lead;
|
||||
register int trail;
|
||||
|
||||
int DIVISOR = 100;
|
||||
trail = a % DIVISOR + b % DIVISOR;
|
||||
lead = a / DIVISOR + b / DIVISOR + trail / DIVISOR;
|
||||
trail %= DIVISOR;
|
||||
if (trail < 0 && lead > 0) {
|
||||
trail += DIVISOR;
|
||||
--lead;
|
||||
} else if (lead < 0 && trail > 0) {
|
||||
trail -= DIVISOR;
|
||||
++lead;
|
||||
}
|
||||
if (convert_top) {
|
||||
if (lead == 0 && trail < 0)
|
||||
pt = _add("-0", pt, ptlim);
|
||||
else pt = _conv(lead, "%02d", pt, ptlim);
|
||||
}
|
||||
if (convert_yy)
|
||||
pt = _conv(((trail < 0) ? -trail : trail), "%02d", pt, ptlim);
|
||||
return pt;
|
||||
}
|
||||
|
||||
static char *
|
||||
_fmt(const char *format, const struct tm *t, char *pt,
|
||||
const char *ptlim, enum warn *warnp)
|
||||
{
|
||||
struct lc_time_T const *Locale = &C_time_locale;
|
||||
|
||||
for ( ; *format; ++format) {
|
||||
if (*format == '%') {
|
||||
label:
|
||||
switch (*++format) {
|
||||
case '\0':
|
||||
--format;
|
||||
break;
|
||||
case 'A':
|
||||
pt = _add((t->tm_wday < 0 ||
|
||||
t->tm_wday >= DAYSPERWEEK) ?
|
||||
"?" : Locale->weekday[t->tm_wday],
|
||||
pt, ptlim);
|
||||
continue;
|
||||
case 'a':
|
||||
pt = _add((t->tm_wday < 0 ||
|
||||
t->tm_wday >= DAYSPERWEEK) ?
|
||||
"?" : Locale->wday[t->tm_wday],
|
||||
pt, ptlim);
|
||||
continue;
|
||||
case 'B':
|
||||
pt = _add((t->tm_mon < 0 ||
|
||||
t->tm_mon >= MONSPERYEAR) ?
|
||||
"?" : Locale->month[t->tm_mon],
|
||||
pt, ptlim);
|
||||
continue;
|
||||
case 'b':
|
||||
case 'h':
|
||||
pt = _add((t->tm_mon < 0 ||
|
||||
t->tm_mon >= MONSPERYEAR) ?
|
||||
"?" : Locale->mon[t->tm_mon],
|
||||
pt, ptlim);
|
||||
continue;
|
||||
case 'C':
|
||||
/*
|
||||
** %C used to do a...
|
||||
** _fmt("%a %b %e %X %Y", t);
|
||||
** ...whereas now POSIX 1003.2 calls for
|
||||
** something completely different.
|
||||
** (ado, 1993-05-24)
|
||||
*/
|
||||
pt = _yconv(t->tm_year, TM_YEAR_BASE,
|
||||
true, false, pt, ptlim);
|
||||
continue;
|
||||
case 'c':
|
||||
{
|
||||
enum warn warn2 = IN_SOME;
|
||||
|
||||
pt = _fmt(Locale->c_fmt, t, pt, ptlim, &warn2);
|
||||
if (warn2 == IN_ALL)
|
||||
warn2 = IN_THIS;
|
||||
if (warn2 > *warnp)
|
||||
*warnp = warn2;
|
||||
}
|
||||
continue;
|
||||
case 'D':
|
||||
pt = _fmt("%m/%d/%y", t, pt, ptlim, warnp);
|
||||
continue;
|
||||
case 'd':
|
||||
pt = _conv(t->tm_mday, "%02d", pt, ptlim);
|
||||
continue;
|
||||
case 'E':
|
||||
case 'O':
|
||||
/*
|
||||
** Locale modifiers of C99 and later.
|
||||
** The sequences
|
||||
** %Ec %EC %Ex %EX %Ey %EY
|
||||
** %Od %oe %OH %OI %Om %OM
|
||||
** %OS %Ou %OU %OV %Ow %OW %Oy
|
||||
** are supposed to provide alternative
|
||||
** representations.
|
||||
*/
|
||||
goto label;
|
||||
case 'e':
|
||||
pt = _conv(t->tm_mday, "%2d", pt, ptlim);
|
||||
continue;
|
||||
case 'F':
|
||||
pt = _fmt("%Y-%m-%d", t, pt, ptlim, warnp);
|
||||
continue;
|
||||
case 'H':
|
||||
pt = _conv(t->tm_hour, "%02d", pt, ptlim);
|
||||
continue;
|
||||
case 'I':
|
||||
pt = _conv((t->tm_hour % 12) ?
|
||||
(t->tm_hour % 12) : 12,
|
||||
"%02d", pt, ptlim);
|
||||
continue;
|
||||
case 'j':
|
||||
pt = _conv(t->tm_yday + 1, "%03d", pt, ptlim);
|
||||
continue;
|
||||
case 'k':
|
||||
/*
|
||||
** This used to be...
|
||||
** _conv(t->tm_hour % 12 ?
|
||||
** t->tm_hour % 12 : 12, 2, ' ');
|
||||
** ...and has been changed to the below to
|
||||
** match SunOS 4.1.1 and Arnold Robbins'
|
||||
** strftime version 3.0. That is, "%k" and
|
||||
** "%l" have been swapped.
|
||||
** (ado, 1993-05-24)
|
||||
*/
|
||||
pt = _conv(t->tm_hour, "%2d", pt, ptlim);
|
||||
continue;
|
||||
#ifdef KITCHEN_SINK
|
||||
case 'K':
|
||||
/*
|
||||
** After all this time, still unclaimed!
|
||||
*/
|
||||
pt = _add("kitchen sink", pt, ptlim);
|
||||
continue;
|
||||
#endif /* defined KITCHEN_SINK */
|
||||
case 'l':
|
||||
/*
|
||||
** This used to be...
|
||||
** _conv(t->tm_hour, 2, ' ');
|
||||
** ...and has been changed to the below to
|
||||
** match SunOS 4.1.1 and Arnold Robbin's
|
||||
** strftime version 3.0. That is, "%k" and
|
||||
** "%l" have been swapped.
|
||||
** (ado, 1993-05-24)
|
||||
*/
|
||||
pt = _conv((t->tm_hour % 12) ?
|
||||
(t->tm_hour % 12) : 12,
|
||||
"%2d", pt, ptlim);
|
||||
continue;
|
||||
case 'M':
|
||||
pt = _conv(t->tm_min, "%02d", pt, ptlim);
|
||||
continue;
|
||||
case 'm':
|
||||
pt = _conv(t->tm_mon + 1, "%02d", pt, ptlim);
|
||||
continue;
|
||||
case 'n':
|
||||
pt = _add("\n", pt, ptlim);
|
||||
continue;
|
||||
case 'p':
|
||||
pt = _add((t->tm_hour >= (HOURSPERDAY / 2)) ?
|
||||
Locale->pm :
|
||||
Locale->am,
|
||||
pt, ptlim);
|
||||
continue;
|
||||
case 'R':
|
||||
pt = _fmt("%H:%M", t, pt, ptlim, warnp);
|
||||
continue;
|
||||
case 'r':
|
||||
pt = _fmt("%I:%M:%S %p", t, pt, ptlim, warnp);
|
||||
continue;
|
||||
case 'S':
|
||||
pt = _conv(t->tm_sec, "%02d", pt, ptlim);
|
||||
continue;
|
||||
case 's':
|
||||
{
|
||||
struct tm tm;
|
||||
char buf[INT_STRLEN_MAXIMUM(
|
||||
time_t) + 1];
|
||||
time_t mkt;
|
||||
|
||||
tm.tm_sec = t->tm_sec;
|
||||
tm.tm_min = t->tm_min;
|
||||
tm.tm_hour = t->tm_hour;
|
||||
tm.tm_mday = t->tm_mday;
|
||||
tm.tm_mon = t->tm_mon;
|
||||
tm.tm_year = t->tm_year;
|
||||
#ifdef TM_GMTOFF
|
||||
mkt = timeoff(&tm, t->TM_GMTOFF);
|
||||
#else
|
||||
tm.tm_isdst = t->tm_isdst;
|
||||
mkt = mktime(&tm);
|
||||
#endif
|
||||
/* If mktime fails, %s expands to the
|
||||
value of (time_t) -1 as a failure
|
||||
marker; this is better in practice
|
||||
than strftime failing. */
|
||||
if (TYPE_SIGNED(time_t)) {
|
||||
intmax_t n = mkt;
|
||||
sprintf(buf, "%"PRIdMAX, n);
|
||||
} else {
|
||||
uintmax_t n = mkt;
|
||||
sprintf(buf, "%"PRIuMAX, n);
|
||||
}
|
||||
pt = _add(buf, pt, ptlim);
|
||||
}
|
||||
continue;
|
||||
case 'T':
|
||||
pt = _fmt("%H:%M:%S", t, pt, ptlim, warnp);
|
||||
continue;
|
||||
case 't':
|
||||
pt = _add("\t", pt, ptlim);
|
||||
continue;
|
||||
case 'U':
|
||||
pt = _conv((t->tm_yday + DAYSPERWEEK -
|
||||
t->tm_wday) / DAYSPERWEEK,
|
||||
"%02d", pt, ptlim);
|
||||
continue;
|
||||
case 'u':
|
||||
/*
|
||||
** From Arnold Robbins' strftime version 3.0:
|
||||
** "ISO 8601: Weekday as a decimal number
|
||||
** [1 (Monday) - 7]"
|
||||
** (ado, 1993-05-24)
|
||||
*/
|
||||
pt = _conv((t->tm_wday == 0) ?
|
||||
DAYSPERWEEK : t->tm_wday,
|
||||
"%d", pt, ptlim);
|
||||
continue;
|
||||
case 'V': /* ISO 8601 week number */
|
||||
case 'G': /* ISO 8601 year (four digits) */
|
||||
case 'g': /* ISO 8601 year (two digits) */
|
||||
/*
|
||||
** From Arnold Robbins' strftime version 3.0: "the week number of the
|
||||
** year (the first Monday as the first day of week 1) as a decimal number
|
||||
** (01-53)."
|
||||
** (ado, 1993-05-24)
|
||||
**
|
||||
** From <https://www.cl.cam.ac.uk/~mgk25/iso-time.html> by Markus Kuhn:
|
||||
** "Week 01 of a year is per definition the first week which has the
|
||||
** Thursday in this year, which is equivalent to the week which contains
|
||||
** the fourth day of January. In other words, the first week of a new year
|
||||
** is the week which has the majority of its days in the new year. Week 01
|
||||
** might also contain days from the previous year and the week before week
|
||||
** 01 of a year is the last week (52 or 53) of the previous year even if
|
||||
** it contains days from the new year. A week starts with Monday (day 1)
|
||||
** and ends with Sunday (day 7). For example, the first week of the year
|
||||
** 1997 lasts from 1996-12-30 to 1997-01-05..."
|
||||
** (ado, 1996-01-02)
|
||||
*/
|
||||
{
|
||||
int year;
|
||||
int base;
|
||||
int yday;
|
||||
int wday;
|
||||
int w;
|
||||
|
||||
year = t->tm_year;
|
||||
base = TM_YEAR_BASE;
|
||||
yday = t->tm_yday;
|
||||
wday = t->tm_wday;
|
||||
for ( ; ; ) {
|
||||
int len;
|
||||
int bot;
|
||||
int top;
|
||||
|
||||
len = isleap_sum(year, base) ?
|
||||
DAYSPERLYEAR :
|
||||
DAYSPERNYEAR;
|
||||
/*
|
||||
** What yday (-3 ... 3) does
|
||||
** the ISO year begin on?
|
||||
*/
|
||||
bot = ((yday + 11 - wday) %
|
||||
DAYSPERWEEK) - 3;
|
||||
/*
|
||||
** What yday does the NEXT
|
||||
** ISO year begin on?
|
||||
*/
|
||||
top = bot -
|
||||
(len % DAYSPERWEEK);
|
||||
if (top < -3)
|
||||
top += DAYSPERWEEK;
|
||||
top += len;
|
||||
if (yday >= top) {
|
||||
++base;
|
||||
w = 1;
|
||||
break;
|
||||
}
|
||||
if (yday >= bot) {
|
||||
w = 1 + ((yday - bot) /
|
||||
DAYSPERWEEK);
|
||||
break;
|
||||
}
|
||||
--base;
|
||||
yday += isleap_sum(year, base) ?
|
||||
DAYSPERLYEAR :
|
||||
DAYSPERNYEAR;
|
||||
}
|
||||
#ifdef XPG4_1994_04_09
|
||||
if ((w == 52 &&
|
||||
t->tm_mon == TM_JANUARY) ||
|
||||
(w == 1 &&
|
||||
t->tm_mon == TM_DECEMBER))
|
||||
w = 53;
|
||||
#endif /* defined XPG4_1994_04_09 */
|
||||
if (*format == 'V')
|
||||
pt = _conv(w, "%02d",
|
||||
pt, ptlim);
|
||||
else if (*format == 'g') {
|
||||
*warnp = IN_ALL;
|
||||
pt = _yconv(year, base,
|
||||
false, true,
|
||||
pt, ptlim);
|
||||
} else pt = _yconv(year, base,
|
||||
true, true,
|
||||
pt, ptlim);
|
||||
}
|
||||
continue;
|
||||
case 'v':
|
||||
/*
|
||||
** From Arnold Robbins' strftime version 3.0:
|
||||
** "date as dd-bbb-YYYY"
|
||||
** (ado, 1993-05-24)
|
||||
*/
|
||||
pt = _fmt("%e-%b-%Y", t, pt, ptlim, warnp);
|
||||
continue;
|
||||
case 'W':
|
||||
pt = _conv((t->tm_yday + DAYSPERWEEK -
|
||||
(t->tm_wday ?
|
||||
(t->tm_wday - 1) :
|
||||
(DAYSPERWEEK - 1))) / DAYSPERWEEK,
|
||||
"%02d", pt, ptlim);
|
||||
continue;
|
||||
case 'w':
|
||||
pt = _conv(t->tm_wday, "%d", pt, ptlim);
|
||||
continue;
|
||||
case 'X':
|
||||
pt = _fmt(Locale->X_fmt, t, pt, ptlim, warnp);
|
||||
continue;
|
||||
case 'x':
|
||||
{
|
||||
enum warn warn2 = IN_SOME;
|
||||
|
||||
pt = _fmt(Locale->x_fmt, t, pt, ptlim, &warn2);
|
||||
if (warn2 == IN_ALL)
|
||||
warn2 = IN_THIS;
|
||||
if (warn2 > *warnp)
|
||||
*warnp = warn2;
|
||||
}
|
||||
continue;
|
||||
case 'y':
|
||||
*warnp = IN_ALL;
|
||||
pt = _yconv(t->tm_year, TM_YEAR_BASE,
|
||||
false, true,
|
||||
pt, ptlim);
|
||||
continue;
|
||||
case 'Y':
|
||||
pt = _yconv(t->tm_year, TM_YEAR_BASE,
|
||||
true, true,
|
||||
pt, ptlim);
|
||||
continue;
|
||||
case 'Z':
|
||||
#ifdef TM_ZONE
|
||||
pt = _add(t->TM_ZONE, pt, ptlim);
|
||||
#elif HAVE_TZNAME
|
||||
if (t->tm_isdst >= 0)
|
||||
pt = _add(tzname[t->tm_isdst != 0],
|
||||
pt, ptlim);
|
||||
#endif
|
||||
/*
|
||||
** C99 and later say that %Z must be
|
||||
** replaced by the empty string if the
|
||||
** time zone abbreviation is not
|
||||
** determinable.
|
||||
*/
|
||||
continue;
|
||||
case 'z':
|
||||
#if defined TM_GMTOFF || USG_COMPAT || ALTZONE
|
||||
{
|
||||
long diff;
|
||||
char const * sign;
|
||||
bool negative;
|
||||
|
||||
# ifdef TM_GMTOFF
|
||||
diff = t->TM_GMTOFF;
|
||||
# else
|
||||
/*
|
||||
** C99 and later say that the UT offset must
|
||||
** be computed by looking only at
|
||||
** tm_isdst. This requirement is
|
||||
** incorrect, since it means the code
|
||||
** must rely on magic (in this case
|
||||
** altzone and timezone), and the
|
||||
** magic might not have the correct
|
||||
** offset. Doing things correctly is
|
||||
** tricky and requires disobeying the standard;
|
||||
** see GNU C strftime for details.
|
||||
** For now, punt and conform to the
|
||||
** standard, even though it's incorrect.
|
||||
**
|
||||
** C99 and later say that %z must be replaced by
|
||||
** the empty string if the time zone is not
|
||||
** determinable, so output nothing if the
|
||||
** appropriate variables are not available.
|
||||
*/
|
||||
if (t->tm_isdst < 0)
|
||||
continue;
|
||||
if (t->tm_isdst == 0)
|
||||
# if USG_COMPAT
|
||||
diff = -timezone;
|
||||
# else
|
||||
continue;
|
||||
# endif
|
||||
else
|
||||
# if ALTZONE
|
||||
diff = -altzone;
|
||||
# else
|
||||
continue;
|
||||
# endif
|
||||
# endif
|
||||
negative = diff < 0;
|
||||
if (diff == 0) {
|
||||
# ifdef TM_ZONE
|
||||
negative = t->TM_ZONE[0] == '-';
|
||||
# else
|
||||
negative = t->tm_isdst < 0;
|
||||
# if HAVE_TZNAME
|
||||
if (tzname[t->tm_isdst != 0][0] == '-')
|
||||
negative = true;
|
||||
# endif
|
||||
# endif
|
||||
}
|
||||
if (negative) {
|
||||
sign = "-";
|
||||
diff = -diff;
|
||||
} else sign = "+";
|
||||
pt = _add(sign, pt, ptlim);
|
||||
diff /= SECSPERMIN;
|
||||
diff = (diff / MINSPERHOUR) * 100 +
|
||||
(diff % MINSPERHOUR);
|
||||
pt = _conv(diff, "%04d", pt, ptlim);
|
||||
}
|
||||
#endif
|
||||
continue;
|
||||
case '+':
|
||||
pt = _fmt(Locale->date_fmt, t, pt, ptlim,
|
||||
warnp);
|
||||
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) also does.
|
||||
*/
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pt == ptlim)
|
||||
break;
|
||||
*pt++ = *format;
|
||||
}
|
||||
return pt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts time to string, e.g.
|
||||
*
|
||||
* char b[64];
|
||||
* int64_t sec;
|
||||
* struct tm tm;
|
||||
* time(&sec);
|
||||
* localtime_r(&sec, &tm);
|
||||
* strftime(b, sizeof(b), "%Y-%m-%dT%H:%M:%S%z", &tm); // ISO8601
|
||||
* strftime(b, sizeof(b), "%a, %d %b %Y %H:%M:%S %Z", &tm); // RFC1123
|
||||
*
|
||||
* @return bytes copied excluding nul, or 0 on error
|
||||
* @see FormatHttpDateTime()
|
||||
*/
|
||||
size_t
|
||||
strftime(char *restrict s, size_t maxsize, char const *restrict format,
|
||||
struct tm const *restrict t)
|
||||
{
|
||||
char * p;
|
||||
int saved_errno = errno;
|
||||
enum warn warn = IN_NONE;
|
||||
|
||||
tzset();
|
||||
p = _fmt(format, t, s, s + maxsize, &warn);
|
||||
if (!p) {
|
||||
errno = EOVERFLOW;
|
||||
return 0;
|
||||
}
|
||||
if (DEPRECATE_TWO_DIGIT_YEARS
|
||||
&& warn != IN_NONE && getenv(YEAR_2000_NAME)) {
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(stderr, "strftime format \"%s\" ", format);
|
||||
fprintf(stderr, "yields only two digits of years in ");
|
||||
if (warn == IN_SOME)
|
||||
fprintf(stderr, "some locales");
|
||||
else if (warn == IN_THIS)
|
||||
fprintf(stderr, "the current locale");
|
||||
else fprintf(stderr, "all locales");
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if (p == s + maxsize) {
|
||||
errno = ERANGE;
|
||||
return 0;
|
||||
}
|
||||
*p = '\0';
|
||||
errno = saved_errno;
|
||||
return p - s;
|
||||
}
|
||||
|
||||
__weak_reference(strftime, strftime_l);
|
6
third_party/tz/timezone.c
vendored
Normal file
6
third_party/tz/timezone.c
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│
|
||||
│ vi: set noet ft=c ts=8 sw=8 fenc=utf-8 :vi │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/time.h"
|
||||
|
||||
long timezone;
|
6
third_party/tz/tzdir.h
vendored
Normal file
6
third_party/tz/tzdir.h
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
#ifndef TZDEFAULT
|
||||
#define TZDEFAULT "/etc/localtime" /* default zone */
|
||||
#endif
|
||||
#ifndef TZDIR
|
||||
#define TZDIR "/zip/usr/share/zoneinfo" /* TZif directory */
|
||||
#endif
|
119
third_party/tz/tzfile.h
vendored
Normal file
119
third_party/tz/tzfile.h
vendored
Normal file
|
@ -0,0 +1,119 @@
|
|||
/* Layout and location of TZif files. */
|
||||
|
||||
#ifndef TZFILE_H
|
||||
|
||||
#define TZFILE_H
|
||||
|
||||
/*
|
||||
** This file is in the public domain, so clarified as of
|
||||
** 1996-06-05 by Arthur David Olson.
|
||||
*/
|
||||
|
||||
/*
|
||||
** This header is for use ONLY with the time conversion code.
|
||||
** There is no guarantee that it will remain unchanged,
|
||||
** or that it will remain at all.
|
||||
** Do NOT copy it to any system include directory.
|
||||
** Thank you!
|
||||
*/
|
||||
|
||||
/*
|
||||
** Information about time zone files.
|
||||
*/
|
||||
|
||||
#ifndef TZDEFRULES
|
||||
# define TZDEFRULES "posixrules"
|
||||
#endif /* !defined TZDEFRULES */
|
||||
|
||||
|
||||
/* See Internet RFC 8536 for more details about the following format. */
|
||||
|
||||
/*
|
||||
** Each file begins with. . .
|
||||
*/
|
||||
|
||||
#define TZ_MAGIC "TZif"
|
||||
|
||||
struct tzhead {
|
||||
char tzh_magic[4]; /* TZ_MAGIC */
|
||||
char tzh_version[1]; /* '\0' or '2'-'4' as of 2021 */
|
||||
char tzh_reserved[15]; /* reserved; must be zero */
|
||||
char tzh_ttisutcnt[4]; /* coded number of trans. time flags */
|
||||
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 UT 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 1, transition
|
||||
** time is standard time, if 0,
|
||||
** transition time is local (wall clock)
|
||||
** time; if absent, transition times are
|
||||
** assumed to be local time
|
||||
** tzh_ttisutcnt (char)s indexed by type; if 1, transition
|
||||
** time is UT, if 0, transition time is
|
||||
** local time; if absent, transition
|
||||
** times are assumed to be local time.
|
||||
** When this is 1, the corresponding
|
||||
** std/wall indicator must also be 1.
|
||||
*/
|
||||
|
||||
/*
|
||||
** If tzh_version is '2' or greater, the above is followed by a second instance
|
||||
** of tzhead and a second instance of the data in which each coded transition
|
||||
** time uses 8 rather than 4 chars,
|
||||
** then a POSIX-TZ-environment-variable-style string for use in handling
|
||||
** instants after the last transition time stored in the file
|
||||
** (with nothing between the newlines if there is no POSIX.1-2017
|
||||
** representation for such instants).
|
||||
**
|
||||
** If tz_version is '3' or greater, the above is extended as follows.
|
||||
** First, the TZ string's hour offset may range from -167
|
||||
** through 167 as compared to the POSIX-required 0 through 24.
|
||||
** Second, its DST start time may be January 1 at 00:00 and its stop
|
||||
** time December 31 at 24:00 plus the difference between DST and
|
||||
** standard time, indicating DST all year.
|
||||
*/
|
||||
|
||||
/*
|
||||
** In the current implementation, "tzset()" refuses to deal with files that
|
||||
** exceed any of the limits below.
|
||||
*/
|
||||
|
||||
#ifndef TZ_MAX_TIMES
|
||||
/* This must be at least 242 for Europe/London with 'zic -b fat'. */
|
||||
# define TZ_MAX_TIMES 2000
|
||||
#endif /* !defined TZ_MAX_TIMES */
|
||||
|
||||
#ifndef TZ_MAX_TYPES
|
||||
/* This must be at least 18 for Europe/Vilnius with 'zic -b fat'. */
|
||||
# define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */
|
||||
#endif /* !defined TZ_MAX_TYPES */
|
||||
|
||||
#ifndef TZ_MAX_CHARS
|
||||
/* This must be at least 40 for America/Anchorage. */
|
||||
# define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */
|
||||
/* (limited by what unsigned chars can hold) */
|
||||
#endif /* !defined TZ_MAX_CHARS */
|
||||
|
||||
#ifndef TZ_MAX_LEAPS
|
||||
/* This must be at least 27 for leap seconds from 1972 through mid-2023.
|
||||
There's a plan to discontinue leap seconds by 2035. */
|
||||
# define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */
|
||||
#endif /* !defined TZ_MAX_LEAPS */
|
||||
|
||||
#endif /* !defined TZFILE_H */
|
6
third_party/tz/tzname.c
vendored
Normal file
6
third_party/tz/tzname.c
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│
|
||||
│ vi: set noet ft=c ts=8 sw=8 fenc=utf-8 :vi │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/time.h"
|
||||
|
||||
char *tzname[2];
|
163
third_party/tz/windows.py
vendored
Normal file
163
third_party/tz/windows.py
vendored
Normal file
|
@ -0,0 +1,163 @@
|
|||
# Thank you Alejandro Zeise for collecting this information
|
||||
# https://gist.github.com/alejzeis/ad5827eb14b5c22109ba652a1a267af5
|
||||
|
||||
SUPPORTED = set((
|
||||
'Africa/Algiers',
|
||||
'Africa/Cairo',
|
||||
'Africa/Johannesburg',
|
||||
'Africa/Lagos',
|
||||
'Africa/Nairobi',
|
||||
'America/Anchorage',
|
||||
'America/Argentina/Buenos_Aires',
|
||||
'America/Bogota',
|
||||
'America/Chicago',
|
||||
'America/Denver',
|
||||
'America/Lima',
|
||||
'America/Los_Angeles',
|
||||
'America/Mexico_City',
|
||||
'America/New_York',
|
||||
'America/Phoenix',
|
||||
'America/Santiago',
|
||||
'America/Sao_Paulo',
|
||||
'Asia/Bangkok',
|
||||
'Asia/Dhaka',
|
||||
'Asia/Dubai',
|
||||
'Asia/Hong_Kong',
|
||||
'Asia/Jakarta',
|
||||
'Asia/Jerusalem',
|
||||
'Asia/Kabul',
|
||||
'Asia/Karachi',
|
||||
'Asia/Kolkata',
|
||||
'Asia/Manila',
|
||||
'Asia/Seoul',
|
||||
'Asia/Shanghai',
|
||||
'Asia/Singapore',
|
||||
'Asia/Taipei',
|
||||
'Asia/Tehran',
|
||||
'Asia/Tokyo',
|
||||
'Australia/Adelaide',
|
||||
'Australia/Brisbane',
|
||||
'Australia/Melbourne',
|
||||
'Australia/Perth',
|
||||
'Australia/Sydney',
|
||||
'CET',
|
||||
'CST6CDT',
|
||||
'EET',
|
||||
'EST',
|
||||
'EST5EDT',
|
||||
'Etc/GMT',
|
||||
'Etc/GMT+1',
|
||||
'Etc/GMT+10',
|
||||
'Etc/GMT+11',
|
||||
'Etc/GMT+12',
|
||||
'Etc/GMT+2',
|
||||
'Etc/GMT+3',
|
||||
'Etc/GMT+4',
|
||||
'Etc/GMT+5',
|
||||
'Etc/GMT+6',
|
||||
'Etc/GMT+7',
|
||||
'Etc/GMT+8',
|
||||
'Etc/GMT+9',
|
||||
'Etc/GMT-1',
|
||||
'Etc/GMT-10',
|
||||
'Etc/GMT-11',
|
||||
'Etc/GMT-12',
|
||||
'Etc/GMT-13',
|
||||
'Etc/GMT-14',
|
||||
'Etc/GMT-2',
|
||||
'Etc/GMT-3',
|
||||
'Etc/GMT-4',
|
||||
'Etc/GMT-5',
|
||||
'Etc/GMT-6',
|
||||
'Etc/GMT-7',
|
||||
'Etc/GMT-8',
|
||||
'Etc/GMT-9',
|
||||
'Etc/UTC',
|
||||
'Europe/Berlin',
|
||||
'Europe/Brussels',
|
||||
'Europe/Budapest',
|
||||
'Europe/Dublin',
|
||||
'Europe/Istanbul',
|
||||
'Europe/Kyiv',
|
||||
'Europe/London',
|
||||
'Europe/Madrid',
|
||||
'Europe/Moscow',
|
||||
'Europe/Paris',
|
||||
'Europe/Prague',
|
||||
'Europe/Rome',
|
||||
'Europe/Vienna',
|
||||
'Europe/Warsaw',
|
||||
'Europe/Zurich',
|
||||
'GMT',
|
||||
'HST',
|
||||
'MET',
|
||||
'MST',
|
||||
'MST7MDT',
|
||||
'PST8PDT',
|
||||
'Pacific/Auckland',
|
||||
'Pacific/Fiji',
|
||||
'Pacific/Guam',
|
||||
'Pacific/Honolulu',
|
||||
'Pacific/Port_Moresby',
|
||||
'WET',
|
||||
))
|
||||
|
||||
import re
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
NAMES = set()
|
||||
ZONES = set()
|
||||
SUPERFLUOUS = set()
|
||||
TABLE1 = []
|
||||
TABLE2 = []
|
||||
|
||||
with open("/home/jart/scratch/windows-timezone-mappings.csv") as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if not line:
|
||||
break
|
||||
name, what, zone = line.split(',')
|
||||
if name in NAMES:
|
||||
continue
|
||||
ZZ = zone.split() # has superfluous zones
|
||||
ZZ = [z for z in ZZ if z in SUPPORTED] + [z for z in ZZ if z not in SUPPORTED]
|
||||
zone = ZZ[0]
|
||||
rest = ZZ[1:]
|
||||
NAMES.add(name)
|
||||
ZONES.add(ZZ[0])
|
||||
SUPERFLUOUS |= set(rest)
|
||||
os.environ['TZ'] = zone
|
||||
p = subprocess.Popen(['date', '+%z@%Z'], stdout=subprocess.PIPE)
|
||||
z, Z = p.stdout.read().decode('utf-8').strip().split('@')
|
||||
print("%-35s %-5s %-10s %-10s %-30s" % (name, what, z, Z, zone))
|
||||
if zone in SUPPORTED:
|
||||
TABLE1.append((name, zone, z, Z))
|
||||
else:
|
||||
TABLE2.append((name, zone, z, Z))
|
||||
|
||||
print()
|
||||
TABLE1.sort()
|
||||
TABLE2.sort()
|
||||
for k, v, z, Z in TABLE1:
|
||||
print('{"%s", "%s"}, // %s %s' % (k, v, z, Z))
|
||||
print('#ifdef EMBED_EVERY_TIME_ZONE')
|
||||
for k, v, z, Z in TABLE2:
|
||||
print('{"%s", "%s"}, // %s %s' % (k, v, z, Z))
|
||||
print('#endif')
|
||||
|
||||
# print()
|
||||
# TABLE.sort(key=lambda x: (int(x[2]), x[1]))
|
||||
# for k, v, z, Z in TABLE:
|
||||
# if re.search(r'[A-Z]', Z):
|
||||
# Z = ' ' + Z
|
||||
# else:
|
||||
# Z = ''
|
||||
# print('__static_yoink("usr/share/zoneinfo/%s"); // %s%s (%s)' % (v, z, Z, k))
|
||||
# print('#ifdef EMBED_EVERY_TIME_ZONE')
|
||||
# print('#endif')
|
||||
|
||||
# print()
|
||||
# SUPERFLUOUS -= ZONES
|
||||
# for z in SUPERFLUOUS:
|
||||
# print(z)
|
4
third_party/unzip/BUILD.mk
vendored
4
third_party/unzip/BUILD.mk
vendored
|
@ -23,8 +23,8 @@ THIRD_PARTY_UNZIP_A_DIRECTDEPS = \
|
|||
LIBC_STDIO \
|
||||
LIBC_STR \
|
||||
LIBC_SYSV \
|
||||
LIBC_TIME \
|
||||
THIRD_PARTY_BZIP2
|
||||
THIRD_PARTY_BZIP2 \
|
||||
THIRD_PARTY_TZ
|
||||
|
||||
THIRD_PARTY_UNZIP_A_DEPS := \
|
||||
$(call uniq,$(foreach x,$(THIRD_PARTY_UNZIP_A_DIRECTDEPS),$($(x))))
|
||||
|
|
2
third_party/unzip/timezone.c
vendored
2
third_party/unzip/timezone.c
vendored
|
@ -36,7 +36,7 @@
|
|||
|
||||
|
||||
#include "third_party/unzip/zip.h"
|
||||
#include "libc/time/struct/tm.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/unzip/timezone.h"
|
||||
|
||||
#ifdef IZTZ_DEFINESTDGLOBALS
|
||||
|
|
4
third_party/unzip/unix.c
vendored
4
third_party/unzip/unix.c
vendored
|
@ -30,9 +30,9 @@
|
|||
#define UNZIP_INTERNAL
|
||||
#include "libc/calls/struct/dirent.h"
|
||||
#include "libc/log/log.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "third_party/unzip/unzip.h"
|
||||
#include "libc/time/struct/utimbuf.h"
|
||||
#include "libc/utime.h"
|
||||
#include "third_party/unzip/globals.h"
|
||||
|
||||
#ifdef USE_ICONV_MAPPING
|
||||
|
|
2
third_party/unzip/unxcfg.h
vendored
2
third_party/unzip/unxcfg.h
vendored
|
@ -15,7 +15,7 @@
|
|||
#include "libc/calls/struct/stat.h"
|
||||
#include "libc/sysv/consts/o.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "libc/calls/weirdtypes.h"
|
||||
|
||||
|
||||
|
|
2
third_party/xxhash/BUILD.mk
vendored
2
third_party/xxhash/BUILD.mk
vendored
|
@ -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))))
|
||||
|
|
3
third_party/xxhash/cli/xsum_bench.c
vendored
3
third_party/xxhash/cli/xsum_bench.c
vendored
|
@ -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
|
||||
|
|
4
third_party/xxhash/cli/xsum_config.h
vendored
4
third_party/xxhash/cli/xsum_config.h
vendored
|
@ -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
|
||||
|
|
6
third_party/xxhash/cli/xsum_os_specific.c
vendored
6
third_party/xxhash/cli/xsum_os_specific.c
vendored
|
@ -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
|
||||
|
|
6
third_party/xxhash/tests/bench/timefn.h
vendored
6
third_party/xxhash/tests/bench/timefn.h
vendored
|
@ -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 */
|
||||
|
||||
|
||||
|
||||
|
|
3
third_party/xxhash/tests/collisions/main.c
vendored
3
third_party/xxhash/tests/collisions/main.c
vendored
|
@ -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)
|
||||
{
|
||||
|
|
2
third_party/zip/BUILD.mk
vendored
2
third_party/zip/BUILD.mk
vendored
|
@ -90,9 +90,9 @@ THIRD_PARTY_ZIP_DIRECTDEPS = \
|
|||
LIBC_PROC \
|
||||
LIBC_STR \
|
||||
LIBC_SYSV \
|
||||
LIBC_TIME \
|
||||
LIBC_X \
|
||||
THIRD_PARTY_BZIP2 \
|
||||
THIRD_PARTY_TZ \
|
||||
THIRD_PARTY_ZLIB
|
||||
|
||||
THIRD_PARTY_ZIP_DEPS := \
|
||||
|
|
3
third_party/zip/crypt.c
vendored
3
third_party/zip/crypt.c
vendored
|
@ -80,8 +80,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" /* time() function supplies first part of crypt seed */
|
||||
#include "libc/time.h" /* time() function supplies first part of crypt seed */
|
||||
/* "last resort" source for second part of crypt seed pattern */
|
||||
# ifndef ZCR_SEED2
|
||||
# define ZCR_SEED2 (unsigned)3141592654L /* use PI as default pattern */
|
||||
|
|
3
third_party/zip/fileio.c
vendored
3
third_party/zip/fileio.c
vendored
|
@ -30,8 +30,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"
|
||||
#include "libc/time.h"
|
||||
|
||||
#ifdef NO_MKTIME
|
||||
time_t mktime OF((struct tm *));
|
||||
|
|
2
third_party/zip/osdep.h
vendored
2
third_party/zip/osdep.h
vendored
|
@ -41,7 +41,7 @@
|
|||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/sysv/consts/s.h"
|
||||
#include "libc/sysv/consts/utime.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
|
||||
/* printf format size prefix for zoff_t values */
|
||||
#ifdef LARGE_FILE_SUPPORT
|
||||
|
|
4
third_party/zip/tailor.h
vendored
4
third_party/zip/tailor.h
vendored
|
@ -258,7 +258,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" /* usually defines _POSIX_VERSION */
|
||||
#endif /* !NO_UNISTD_H */
|
||||
|
@ -382,7 +382,7 @@ IZ_IMP char *mktemp();
|
|||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/str/unicode.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/time.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/str/str.h"
|
||||
|
|
6
third_party/zip/unix.c
vendored
6
third_party/zip/unix.c
vendored
|
@ -19,8 +19,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"
|
||||
#include "libc/time.h"
|
||||
|
||||
#if defined(MINIX) || defined(__mpexl)
|
||||
# ifdef S_IWRITE
|
||||
|
@ -60,8 +59,7 @@
|
|||
/* Library functions not in (most) header files */
|
||||
|
||||
#ifdef _POSIX_VERSION
|
||||
#include "libc/time/struct/utimbuf.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/utime.h"
|
||||
#else
|
||||
int utime OF((char *, time_t *));
|
||||
#endif
|
||||
|
|
3
third_party/zip/zip.c
vendored
3
third_party/zip/zip.c
vendored
|
@ -20,8 +20,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" /* for tzset() declaration */
|
||||
#include "libc/time.h" /* for tzset() declaration */
|
||||
#if defined(WIN32) || defined(WINDLL)
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
#include "libc/nt/accounting.h"
|
||||
|
|
1
third_party/zstd/BUILD.mk
vendored
1
third_party/zstd/BUILD.mk
vendored
|
@ -124,7 +124,6 @@ THIRD_PARTY_ZSTD_A_DIRECTDEPS = \
|
|||
LIBC_STDIO \
|
||||
LIBC_STR \
|
||||
LIBC_THREAD \
|
||||
LIBC_TIME \
|
||||
LIBC_SYSV
|
||||
|
||||
THIRD_PARTY_ZSTD_A_DEPS := \
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue