mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-28 13:30: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
|
@ -132,6 +132,14 @@ o/$(MODE)/libc/intrin/ktcpoptnames.o: libc/intrin/ktcpoptnames.S
|
|||
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
|
||||
o/$(MODE)/libc/intrin/stackcall.o: libc/intrin/stackcall.S
|
||||
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
|
||||
o/$(MODE)/libc/intrin/kmonthname.o: libc/intrin/kmonthname.S
|
||||
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
|
||||
o/$(MODE)/libc/intrin/kmonthnameshort.o: libc/intrin/kmonthnameshort.S
|
||||
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
|
||||
o/$(MODE)/libc/intrin/kweekdayname.o: libc/intrin/kweekdayname.S
|
||||
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
|
||||
o/$(MODE)/libc/intrin/kweekdaynameshort.o: libc/intrin/kweekdaynameshort.S
|
||||
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
|
||||
|
||||
LIBC_INTRIN_LIBS = $(foreach x,$(LIBC_INTRIN_ARTIFACTS),$($(x)))
|
||||
LIBC_INTRIN_HDRS = $(foreach x,$(LIBC_INTRIN_ARTIFACTS),$($(x)_HDRS))
|
||||
|
|
30
libc/intrin/kmonthname.S
Normal file
30
libc/intrin/kmonthname.S
Normal file
|
@ -0,0 +1,30 @@
|
|||
#if 0
|
||||
/*─────────────────────────────────────────────────────────────────╗
|
||||
│ To the extent possible under law, Justine Tunney has waived │
|
||||
│ all copyright and related or neighboring rights to this file, │
|
||||
│ as it is written in the following disclaimers: │
|
||||
│ • http://unlicense.org/ │
|
||||
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
|
||||
╚─────────────────────────────────────────────────────────────────*/
|
||||
#endif
|
||||
#include "libc/macros.internal.h"
|
||||
|
||||
// extern const char kMonthName[12][10];
|
||||
.section .rodata,"a",@progbits
|
||||
.underrun
|
||||
kMonthName:
|
||||
.ascin "January",10
|
||||
.ascin "February",10
|
||||
.ascin "March",10
|
||||
.ascin "April",10
|
||||
.ascin "May",10
|
||||
.ascin "June",10
|
||||
.ascin "July",10
|
||||
.ascin "August",10
|
||||
.ascin "September",10
|
||||
.ascin "October",10
|
||||
.ascin "November",10
|
||||
.ascin "December",10
|
||||
.endobj kMonthName,globl
|
||||
.overrun
|
||||
.previous
|
36
libc/intrin/kmonthnameshort.S
Normal file
36
libc/intrin/kmonthnameshort.S
Normal file
|
@ -0,0 +1,36 @@
|
|||
#if 0
|
||||
/*─────────────────────────────────────────────────────────────────╗
|
||||
│ To the extent possible under law, Justine Tunney has waived │
|
||||
│ all copyright and related or neighboring rights to this file, │
|
||||
│ as it is written in the following disclaimers: │
|
||||
│ • http://unlicense.org/ │
|
||||
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
|
||||
╚─────────────────────────────────────────────────────────────────*/
|
||||
#endif
|
||||
#include "libc/macros.internal.h"
|
||||
|
||||
// Type #1:
|
||||
// - Indexable C-String Array
|
||||
// - extern const char kMonthNameShort[12][4];
|
||||
// Type #2:
|
||||
// - Double-NUL Terminated String
|
||||
// - extern const char kMonthNameShort[];
|
||||
.section .rodata,"a",@progbits
|
||||
.underrun
|
||||
kMonthNameShort:
|
||||
.ascin "Jan",4
|
||||
.ascin "Feb",4
|
||||
.ascin "Mar",4
|
||||
.ascin "Apr",4
|
||||
.ascin "May",4
|
||||
.ascin "Jun",4
|
||||
.ascin "Jul",4
|
||||
.ascin "Aug",4
|
||||
.ascin "Sep",4
|
||||
.ascin "Oct",4
|
||||
.ascin "Nov",4
|
||||
.ascin "Dec",4
|
||||
.byte 0
|
||||
.endobj kMonthNameShort,globl
|
||||
.overrun
|
||||
.previous
|
25
libc/intrin/kweekdayname.S
Normal file
25
libc/intrin/kweekdayname.S
Normal file
|
@ -0,0 +1,25 @@
|
|||
#if 0
|
||||
/*─────────────────────────────────────────────────────────────────╗
|
||||
│ To the extent possible under law, Justine Tunney has waived │
|
||||
│ all copyright and related or neighboring rights to this file, │
|
||||
│ as it is written in the following disclaimers: │
|
||||
│ • http://unlicense.org/ │
|
||||
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
|
||||
╚─────────────────────────────────────────────────────────────────*/
|
||||
#endif
|
||||
#include "libc/macros.internal.h"
|
||||
|
||||
// extern const char kWeekdayName[7][10];
|
||||
.section .rodata,"a",@progbits
|
||||
.underrun
|
||||
kWeekdayName:
|
||||
.ascin "Sunday",10
|
||||
.ascin "Monday",10
|
||||
.ascin "Tuesday",10
|
||||
.ascin "Wednesday",10
|
||||
.ascin "Thursday",10
|
||||
.ascin "Friday",10
|
||||
.ascin "Saturday",10
|
||||
.endobj kWeekdayName,globl
|
||||
.overrun
|
||||
.previous
|
31
libc/intrin/kweekdaynameshort.S
Normal file
31
libc/intrin/kweekdaynameshort.S
Normal file
|
@ -0,0 +1,31 @@
|
|||
#if 0
|
||||
/*─────────────────────────────────────────────────────────────────╗
|
||||
│ To the extent possible under law, Justine Tunney has waived │
|
||||
│ all copyright and related or neighboring rights to this file, │
|
||||
│ as it is written in the following disclaimers: │
|
||||
│ • http://unlicense.org/ │
|
||||
│ • http://creativecommons.org/publicdomain/zero/1.0/ │
|
||||
╚─────────────────────────────────────────────────────────────────*/
|
||||
#endif
|
||||
#include "libc/macros.internal.h"
|
||||
|
||||
// Type #1:
|
||||
// - Indexable C-String Array
|
||||
// - extern const char kWeekdayNameShort[7][4];
|
||||
// Type #2:
|
||||
// - Double-NUL Terminated String
|
||||
// - extern const char kWeekdayNameShort[];
|
||||
.section .rodata,"a",@progbits
|
||||
.underrun
|
||||
kWeekdayNameShort:
|
||||
.asciz "Sun"
|
||||
.asciz "Mon"
|
||||
.asciz "Tue"
|
||||
.asciz "Wed"
|
||||
.asciz "Thu"
|
||||
.asciz "Fri"
|
||||
.asciz "Sat"
|
||||
.byte 0
|
||||
.endobj kWeekdayNameShort,globl
|
||||
.overrun
|
||||
.previous
|
|
@ -16,6 +16,7 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/intrin/ubsan.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/intrin/pushpop.internal.h"
|
||||
|
@ -241,6 +242,8 @@ static void __ubsan_warning(const struct UbsanSourceLocation *loc,
|
|||
const char *description) {
|
||||
kprintf("%s:%d: %subsan warning: %s is undefined behavior%s\n", loc->file,
|
||||
loc->line, SUBTLE, description, RESET);
|
||||
if (__ubsan_strict)
|
||||
__ubsan_die()();
|
||||
}
|
||||
|
||||
__wur __ubsan_die_f *__ubsan_abort(const struct UbsanSourceLocation *loc,
|
||||
|
|
8
libc/intrin/ubsan.h
Normal file
8
libc/intrin/ubsan.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_INTRIN_UBSAN_H_
|
||||
#define COSMOPOLITAN_LIBC_INTRIN_UBSAN_H_
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
extern bool32 __ubsan_strict;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* COSMOPOLITAN_LIBC_INTRIN_UBSAN_H_ */
|
23
libc/intrin/ubsanconf.c
Normal file
23
libc/intrin/ubsanconf.c
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2024 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
|
||||
/**
|
||||
* If set to true, UBSAN warnings will become fatal.
|
||||
*/
|
||||
bool32 __ubsan_strict = false;
|
Loading…
Add table
Add a link
Reference in a new issue