Add some comments

This commit is contained in:
Nathan Fisher 2023-06-13 02:12:26 -04:00
parent c4207f940c
commit d9214443a8

View File

@ -280,6 +280,8 @@ pub const DateTime = struct {
seconds += month.seconds(self.year); seconds += month.seconds(self.year);
month = month.next().?; month = month.next().?;
} }
// The days begin numbering with 1, so on the 5th we have had four full
// days plus some remainder. So we take self.days - 1 for our calculation
seconds += @as(i64, self.day - 1) * SECONDS_PER_DAY; seconds += @as(i64, self.day - 1) * SECONDS_PER_DAY;
if (self.hour) |h| { if (self.hour) |h| {
seconds += @as(i64, h - 1) * 3600; seconds += @as(i64, h - 1) * 3600;