Progress..

This commit is contained in:
Nathan Fisher 2024-02-05 12:26:16 -05:00
parent b10b4a79d4
commit 0f1c0a755f
2 changed files with 19 additions and 0 deletions

View file

@ -0,0 +1,5 @@
#include "epoch.h"
int32_t dateTimeGetYear(DateTime *dt) {
return dt->year.year;
}

14
zone.c
View file

@ -31,3 +31,17 @@ void printTz(TimeZone *zone) {
printf("%.2u:%.2u", zone->offset->hours, zone->offset->minutes); 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;
}
}