Skip to content

Commit

Permalink
Import of CCTZ from GitHub.
Browse files Browse the repository at this point in the history
  - d1397431006ea1362a5914d4a90b265d0c7c6f2c Update zoneinfo files to 2024b (#300) by Bradley White <14679271+devbww@users.noreply.github.com>
  - 8bdbd840e97ff32e17f25db85c82589819ad3352 Fix mingw compiler error due to missing function declarat... by Biswapriyo Nath <nathbappai@gmail.com>
  - 6624659e01e73e41527d6b27036e9f79a556560f Add GitHub Actions CI (#299) by Derek Mauro <761129+derekmauro@users.noreply.github.com>

PiperOrigin-RevId: 673451051
Change-Id: Id39f2186bbdcb802d4fc4c5e21207c6f3709c56f
  • Loading branch information
derekmauro authored and copybara-github committed Sep 11, 2024
1 parent 0bc0e9a commit 1d4466e
Show file tree
Hide file tree
Showing 41 changed files with 31 additions and 44 deletions.
12 changes: 6 additions & 6 deletions absl/time/internal/cctz/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ package(features = [

licenses(["notice"])

filegroup(
name = "zoneinfo",
srcs = glob(["testdata/zoneinfo/**"]),
visibility = ["//absl/time:__subpackages__"],
)

### libraries

cc_library(
Expand Down Expand Up @@ -156,12 +162,6 @@ cc_test(
],
)

filegroup(
name = "zoneinfo",
srcs = glob(["testdata/zoneinfo/**"]),
visibility = ["//absl/time:__subpackages__"],
)

### examples

### binaries
1 change: 1 addition & 0 deletions absl/time/internal/cctz/src/time_zone_lookup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include <wchar.h>
#include <windows.globalization.h>
#include <windows.h>
#include <winstring.h>
#endif
#endif

Expand Down
41 changes: 15 additions & 26 deletions absl/time/internal/cctz/src/time_zone_lookup_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1330,35 +1330,24 @@ TEST(TimeZoneEdgeCase, AmericaJamaica) {
ExpectTime(tp, tz, 1983, 12, 31, 23, 59, 59, -5 * 3600, false, "EST");
}

TEST(TimeZoneEdgeCase, WET) {
// Cover some non-existent times within forward transitions.
const time_zone tz = LoadZone("WET");

// Before the first transition.
auto tp = convert(civil_second(1977, 1, 1, 0, 0, 0), tz);
ExpectTime(tp, tz, 1977, 1, 1, 0, 0, 0, 0, false, "WET");

// Over the first transition.
// 228877199 == Sun, 3 Apr 1977 00:59:59 +0000 (WET)
// 228877200 == Sun, 3 Apr 1977 02:00:00 +0100 (WEST)
tp = convert(civil_second(1977, 4, 3, 0, 59, 59), tz);
ExpectTime(tp, tz, 1977, 4, 3, 0, 59, 59, 0, false, "WET");
TEST(TimeZoneEdgeCase, EuropeLisbon) {
// Cover a non-existent time within a forward transition.
const time_zone tz = LoadZone("Europe/Lisbon");

// Over a forward transition.
// 354671999 == Sat, 28 Mar 1981 23:59:59 +0000 (WET)
// 354672000 == Sun, 29 Mar 1981 01:00:00 +0100 (WEST)
auto tp = convert(civil_second(1981, 3, 28, 23, 59, 59), tz);
ExpectTime(tp, tz, 1981, 3, 28, 23, 59, 59, 0, false, "WET");
tp += absl::time_internal::cctz::seconds(1);
ExpectTime(tp, tz, 1977, 4, 3, 2, 0, 0, 1 * 3600, true, "WEST");
ExpectTime(tp, tz, 1981, 3, 29, 1, 0, 0, 1 * 3600, true, "WEST");

// A non-existent time within the first transition.
time_zone::civil_lookup cl1 = tz.lookup(civil_second(1977, 4, 3, 1, 15, 0));
// A non-existent time within the transition.
time_zone::civil_lookup cl1 = tz.lookup(civil_second(1981, 3, 29, 0, 15, 0));
EXPECT_EQ(time_zone::civil_lookup::SKIPPED, cl1.kind);
ExpectTime(cl1.pre, tz, 1977, 4, 3, 2, 15, 0, 1 * 3600, true, "WEST");
ExpectTime(cl1.trans, tz, 1977, 4, 3, 2, 0, 0, 1 * 3600, true, "WEST");
ExpectTime(cl1.post, tz, 1977, 4, 3, 0, 15, 0, 0 * 3600, false, "WET");

// A non-existent time within the second forward transition.
time_zone::civil_lookup cl2 = tz.lookup(civil_second(1978, 4, 2, 1, 15, 0));
EXPECT_EQ(time_zone::civil_lookup::SKIPPED, cl2.kind);
ExpectTime(cl2.pre, tz, 1978, 4, 2, 2, 15, 0, 1 * 3600, true, "WEST");
ExpectTime(cl2.trans, tz, 1978, 4, 2, 2, 0, 0, 1 * 3600, true, "WEST");
ExpectTime(cl2.post, tz, 1978, 4, 2, 0, 15, 0, 0 * 3600, false, "WET");
ExpectTime(cl1.pre, tz, 1981, 3, 29, 1, 15, 0, 1 * 3600, true, "WEST");
ExpectTime(cl1.trans, tz, 1981, 3, 29, 1, 0, 0, 1 * 3600, true, "WEST");
ExpectTime(cl1.post, tz, 1981, 3, 28, 23, 15, 0, 0 * 3600, false, "WET");
}

TEST(TimeZoneEdgeCase, FixedOffsets) {
Expand Down
8 changes: 5 additions & 3 deletions absl/time/internal/cctz/src/tzfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,16 @@ struct tzhead {
** 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
** then a POSIX.1-2017 proleptic TZ 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.
** If tz_version is '3' or greater, the TZ string can be any POSIX.1-2024
** proleptic TZ string, which means 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.
** through 167 as compared to the range 0 through 24 required
** by POSIX.1-2017 and earlier.
** 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.
Expand Down
2 changes: 1 addition & 1 deletion absl/time/internal/cctz/testdata/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024a
2024b
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/Africa/Maputo
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/America/Bahia_Banderas
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/America/Cancun
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/America/Chihuahua
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/America/Ciudad_Juarez
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/America/Ensenada
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/America/Hermosillo
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/America/Mazatlan
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/America/Merida
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/America/Mexico_City
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/America/Monterrey
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/America/Ojinaga
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/America/Santa_Isabel
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/America/Tijuana
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/Asia/Choibalsan
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/Asia/Dili
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/Atlantic/Azores
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/Atlantic/Madeira
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/CET
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/CST6CDT
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/EET
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/EST
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/EST5EDT
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/Europe/Lisbon
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/HST
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/MET
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/MST
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/MST7MDT
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/Mexico/BajaNorte
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/Mexico/BajaSur
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/Mexico/General
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/PST8PDT
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/Portugal
Binary file not shown.
Binary file modified absl/time/internal/cctz/testdata/zoneinfo/WET
Binary file not shown.
3 changes: 1 addition & 2 deletions absl/time/internal/cctz/testdata/zoneinfo/zone1970.tab
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,7 @@ MD +4700+02850 Europe/Chisinau
MH +0905+16720 Pacific/Kwajalein Kwajalein
MM,CC +1647+09610 Asia/Yangon
MN +4755+10653 Asia/Ulaanbaatar most of Mongolia
MN +4801+09139 Asia/Hovd Bayan-Ölgii, Govi-Altai, Hovd, Uvs, Zavkhan
MN +4804+11430 Asia/Choibalsan Dornod, Sükhbaatar
MN +4801+09139 Asia/Hovd Bayan-Ölgii, Hovd, Uvs
MO +221150+1133230 Asia/Macau
MQ +1436-06105 America/Martinique
MT +3554+01431 Europe/Malta
Expand Down
8 changes: 2 additions & 6 deletions absl/time/internal/cctz/testdata/zoneinfo/zonenow.tab
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# From Paul Eggert (2023-12-18):
# This file contains a table where each row stands for a timezone
# where civil timestamps are predicted to agree from now on.
# This file is like zone1970.tab (see zone1970.tab's coments),
# This file is like zone1970.tab (see zone1970.tab's comments),
# but with the following changes:
#
# 1. Each timezone corresponds to a set of clocks that are planned
Expand Down Expand Up @@ -123,8 +123,6 @@ XX +1455-02331 Atlantic/Cape_Verde Cape Verde
#
# -01/+00 (EU DST)
XX +3744-02540 Atlantic/Azores Azores
# -01/+00 (EU DST) until 2024-03-31; then -02/-01 (EU DST)
XX +7029-02158 America/Scoresbysund Ittoqqortoormiit
#
# +00 - GMT
XX +0519-00402 Africa/Abidjan far western Africa; Iceland ("GMT")
Expand Down Expand Up @@ -199,7 +197,7 @@ XX +2518+05518 Asia/Dubai Russia; Caucasus; Persian Gulf; Seychelles; Réunion
XX +3431+06912 Asia/Kabul Afghanistan
#
# +05
XX +4120+06918 Asia/Tashkent Russia; west Kazakhstan; Tajikistan; Turkmenistan; Uzbekistan; Maldives
XX +4120+06918 Asia/Tashkent Russia; Kazakhstan; Tajikistan; Turkmenistan; Uzbekistan; Maldives
#
# +05 - PKT
XX +2452+06703 Asia/Karachi Pakistan ("PKT")
Expand All @@ -215,8 +213,6 @@ XX +2743+08519 Asia/Kathmandu Nepal
#
# +06
XX +2343+09025 Asia/Dhaka Russia; Kyrgyzstan; Bhutan; Bangladesh; Chagos
# +06 until 2024-03-01; then +05
XX +4315+07657 Asia/Almaty Kazakhstan (except western areas)
#
# +06:30
XX +1647+09610 Asia/Yangon Myanmar; Cocos
Expand Down

0 comments on commit 1d4466e

Please sign in to comment.