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; + } +}