aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2024-11-05 12:55:16 +0100
committerGitHub <noreply@github.com>2024-11-05 12:55:16 +0100
commit013c1d31281654ddf218fbcdeade24d3fddee583 (patch)
treeddd0f91b9657bb2f63b5cc55994d5e486f7b6162 /core
parente6475fec4d2a3e34099b24a7a3bf890c7a3ef8d9 (diff)
parentb2d1fbba9cf6bfafc01a4d24af20bfdc79c2652d (diff)
Merge pull request #4456 from colrdavidson/timezones_fix
add new test, better fail-check, and non-transitioning tz fix
Diffstat (limited to 'core')
-rw-r--r--core/time/timezone/tz_windows.odin16
-rw-r--r--core/time/timezone/tzdate.odin2
2 files changed, 18 insertions, 0 deletions
diff --git a/core/time/timezone/tz_windows.odin b/core/time/timezone/tz_windows.odin
index f1604b939..238c4c933 100644
--- a/core/time/timezone/tz_windows.odin
+++ b/core/time/timezone/tz_windows.odin
@@ -203,6 +203,22 @@ generate_rrule_from_tzi :: proc(tzi: ^REG_TZI_FORMAT, abbrevs: TZ_Abbrev, alloca
if err != nil { return }
defer if err != nil { delete(std_name, allocator) }
+ if (tzi.std_date.month == 0) {
+ return datetime.TZ_RRule{
+ has_dst = false,
+
+ std_name = std_name,
+ std_offset = -(i64(tzi.bias) + i64(tzi.std_bias)) * 60,
+ dst_date = datetime.TZ_Transition_Date{
+ type = .Month_Week_Day,
+ month = u8(tzi.std_date.month),
+ week = u8(tzi.std_date.day),
+ day = tzi.std_date.day_of_week,
+ time = (i64(tzi.std_date.hour) * 60 * 60) + (i64(tzi.std_date.minute) * 60) + i64(tzi.std_date.second),
+ },
+ }, true
+ }
+
dst_name: string
dst_name, err = strings.clone(abbrevs.dst, allocator)
if err != nil { return }
diff --git a/core/time/timezone/tzdate.odin b/core/time/timezone/tzdate.odin
index 8f83d1bf4..96df44299 100644
--- a/core/time/timezone/tzdate.odin
+++ b/core/time/timezone/tzdate.odin
@@ -93,6 +93,8 @@ trans_date_to_seconds :: proc(year: i64, td: datetime.TZ_Transition_Date) -> (se
switch td.type {
case .Month_Week_Day:
+ if td.month < 1 { return }
+
t += month_to_seconds(int(td.month) - 1, is_leap)
weekday := ((t + (4 * DAY_SEC)) %% (7 * DAY_SEC)) / DAY_SEC