From 0f1c0a755ffaa4ec9dee5c2e316f01365f625734 Mon Sep 17 00:00:00 2001 From: Nathan Fisher Date: Mon, 5 Feb 2024 12:26:16 -0500 Subject: [PATCH] Progress.. --- datetime.c | 5 +++++ zone.c | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/datetime.c b/datetime.c index e69de29..fc72225 100644 --- a/datetime.c +++ b/datetime.c @@ -0,0 +1,5 @@ +#include "epoch.h" + +int32_t dateTimeGetYear(DateTime *dt) { + return dt->year.year; +} diff --git a/zone.c b/zone.c index ea9aa96..1873241 100644 --- a/zone.c +++ b/zone.c @@ -31,3 +31,17 @@ void printTz(TimeZone *zone) { printf("%.2u:%.2u", zone->offset->hours, zone->offset->minutes); } } + +int64_t timezoneAsSeconds(TimeZone *tz) { + int64_t base; + + switch (tz->tag) { + case Offset: + base = (int64_t)tz->offset->hours * SECONDS_PER_HOUR + (int64_t)tz->offset->minutes * 60; + switch (tz->offset->sign) { + case Negative: return -base; + default: return base; + } + default: return 0; + } +}