Commit 1d4466e8 by Derek Mauro Committed by Copybara-Service

Import of CCTZ from GitHub.

  - 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
parent 0bc0e9a0
...@@ -20,6 +20,12 @@ package(features = [ ...@@ -20,6 +20,12 @@ package(features = [
licenses(["notice"]) licenses(["notice"])
filegroup(
name = "zoneinfo",
srcs = glob(["testdata/zoneinfo/**"]),
visibility = ["//absl/time:__subpackages__"],
)
### libraries ### libraries
cc_library( cc_library(
...@@ -156,12 +162,6 @@ cc_test( ...@@ -156,12 +162,6 @@ cc_test(
], ],
) )
filegroup(
name = "zoneinfo",
srcs = glob(["testdata/zoneinfo/**"]),
visibility = ["//absl/time:__subpackages__"],
)
### examples ### examples
### binaries ### binaries
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include <wchar.h> #include <wchar.h>
#include <windows.globalization.h> #include <windows.globalization.h>
#include <windows.h> #include <windows.h>
#include <winstring.h>
#endif #endif
#endif #endif
......
...@@ -1330,35 +1330,24 @@ TEST(TimeZoneEdgeCase, AmericaJamaica) { ...@@ -1330,35 +1330,24 @@ TEST(TimeZoneEdgeCase, AmericaJamaica) {
ExpectTime(tp, tz, 1983, 12, 31, 23, 59, 59, -5 * 3600, false, "EST"); ExpectTime(tp, tz, 1983, 12, 31, 23, 59, 59, -5 * 3600, false, "EST");
} }
TEST(TimeZoneEdgeCase, WET) { TEST(TimeZoneEdgeCase, EuropeLisbon) {
// Cover some non-existent times within forward transitions. // Cover a non-existent time within a forward transition.
const time_zone tz = LoadZone("WET"); const time_zone tz = LoadZone("Europe/Lisbon");
// Before the first transition. // Over a forward transition.
auto tp = convert(civil_second(1977, 1, 1, 0, 0, 0), tz); // 354671999 == Sat, 28 Mar 1981 23:59:59 +0000 (WET)
ExpectTime(tp, tz, 1977, 1, 1, 0, 0, 0, 0, false, "WET"); // 354672000 == Sun, 29 Mar 1981 01:00:00 +0100 (WEST)
auto tp = convert(civil_second(1981, 3, 28, 23, 59, 59), tz);
// Over the first transition. ExpectTime(tp, tz, 1981, 3, 28, 23, 59, 59, 0, false, "WET");
// 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");
tp += absl::time_internal::cctz::seconds(1); 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. // A non-existent time within the transition.
time_zone::civil_lookup cl1 = tz.lookup(civil_second(1977, 4, 3, 1, 15, 0)); time_zone::civil_lookup cl1 = tz.lookup(civil_second(1981, 3, 29, 0, 15, 0));
EXPECT_EQ(time_zone::civil_lookup::SKIPPED, cl1.kind); 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.pre, tz, 1981, 3, 29, 1, 15, 0, 1 * 3600, true, "WEST");
ExpectTime(cl1.trans, tz, 1977, 4, 3, 2, 0, 0, 1 * 3600, true, "WEST"); ExpectTime(cl1.trans, tz, 1981, 3, 29, 1, 0, 0, 1 * 3600, true, "WEST");
ExpectTime(cl1.post, tz, 1977, 4, 3, 0, 15, 0, 0 * 3600, false, "WET"); ExpectTime(cl1.post, tz, 1981, 3, 28, 23, 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");
} }
TEST(TimeZoneEdgeCase, FixedOffsets) { TEST(TimeZoneEdgeCase, FixedOffsets) {
......
...@@ -75,14 +75,16 @@ struct tzhead { ...@@ -75,14 +75,16 @@ struct tzhead {
** If tzh_version is '2' or greater, the above is followed by a second instance ** 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 ** of tzhead and a second instance of the data in which each coded transition
** time uses 8 rather than 4 chars, ** 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 ** instants after the last transition time stored in the file
** (with nothing between the newlines if there is no POSIX.1-2017 ** (with nothing between the newlines if there is no POSIX.1-2017
** representation for such instants). ** 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 ** 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 ** 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 ** time December 31 at 24:00 plus the difference between DST and
** standard time, indicating DST all year. ** standard time, indicating DST all year.
......
...@@ -209,8 +209,7 @@ MD +4700+02850 Europe/Chisinau ...@@ -209,8 +209,7 @@ MD +4700+02850 Europe/Chisinau
MH +0905+16720 Pacific/Kwajalein Kwajalein MH +0905+16720 Pacific/Kwajalein Kwajalein
MM,CC +1647+09610 Asia/Yangon MM,CC +1647+09610 Asia/Yangon
MN +4755+10653 Asia/Ulaanbaatar most of Mongolia MN +4755+10653 Asia/Ulaanbaatar most of Mongolia
MN +4801+09139 Asia/Hovd Bayan-Ölgii, Govi-Altai, Hovd, Uvs, Zavkhan MN +4801+09139 Asia/Hovd Bayan-Ölgii, Hovd, Uvs
MN +4804+11430 Asia/Choibalsan Dornod, Sükhbaatar
MO +221150+1133230 Asia/Macau MO +221150+1133230 Asia/Macau
MQ +1436-06105 America/Martinique MQ +1436-06105 America/Martinique
MT +3554+01431 Europe/Malta MT +3554+01431 Europe/Malta
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# From Paul Eggert (2023-12-18): # From Paul Eggert (2023-12-18):
# This file contains a table where each row stands for a timezone # This file contains a table where each row stands for a timezone
# where civil timestamps are predicted to agree from now on. # 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: # but with the following changes:
# #
# 1. Each timezone corresponds to a set of clocks that are planned # 1. Each timezone corresponds to a set of clocks that are planned
...@@ -123,8 +123,6 @@ XX +1455-02331 Atlantic/Cape_Verde Cape Verde ...@@ -123,8 +123,6 @@ XX +1455-02331 Atlantic/Cape_Verde Cape Verde
# #
# -01/+00 (EU DST) # -01/+00 (EU DST)
XX +3744-02540 Atlantic/Azores Azores 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 # +00 - GMT
XX +0519-00402 Africa/Abidjan far western Africa; Iceland ("GMT") XX +0519-00402 Africa/Abidjan far western Africa; Iceland ("GMT")
...@@ -199,7 +197,7 @@ XX +2518+05518 Asia/Dubai Russia; Caucasus; Persian Gulf; Seychelles; Réunion ...@@ -199,7 +197,7 @@ XX +2518+05518 Asia/Dubai Russia; Caucasus; Persian Gulf; Seychelles; Réunion
XX +3431+06912 Asia/Kabul Afghanistan XX +3431+06912 Asia/Kabul Afghanistan
# #
# +05 # +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 # +05 - PKT
XX +2452+06703 Asia/Karachi Pakistan ("PKT") XX +2452+06703 Asia/Karachi Pakistan ("PKT")
...@@ -215,8 +213,6 @@ XX +2743+08519 Asia/Kathmandu Nepal ...@@ -215,8 +213,6 @@ XX +2743+08519 Asia/Kathmandu Nepal
# #
# +06 # +06
XX +2343+09025 Asia/Dhaka Russia; Kyrgyzstan; Bhutan; Bangladesh; Chagos 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 # +06:30
XX +1647+09610 Asia/Yangon Myanmar; Cocos XX +1647+09610 Asia/Yangon Myanmar; Cocos
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment