Fix error which crept in due to daylight savings and me being dumb
(clever).
This commit is contained in:
parent
d9214443a8
commit
66b9e61ed4
@ -284,7 +284,7 @@ pub const DateTime = struct {
|
|||||||
// days plus some remainder. So we take self.days - 1 for our calculation
|
// 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) * 3600;
|
||||||
}
|
}
|
||||||
if (self.minute) |m| {
|
if (self.minute) |m| {
|
||||||
seconds += @as(i64, m) * 60;
|
seconds += @as(i64, m) * 60;
|
||||||
@ -334,7 +334,7 @@ test "to timestamp utc" {
|
|||||||
.year = Year.new(2023),
|
.year = Year.new(2023),
|
||||||
.month = .june,
|
.month = .june,
|
||||||
.day = 13,
|
.day = 13,
|
||||||
.hour = 6,
|
.hour = 5,
|
||||||
.minute = 21,
|
.minute = 21,
|
||||||
.second = 22,
|
.second = 22,
|
||||||
.tz = .utc,
|
.tz = .utc,
|
||||||
@ -347,7 +347,7 @@ test "to timestamp negative offset" {
|
|||||||
.year = Year.new(2023),
|
.year = Year.new(2023),
|
||||||
.month = .june,
|
.month = .june,
|
||||||
.day = 13,
|
.day = 13,
|
||||||
.hour = 1,
|
.hour = 0,
|
||||||
.minute = 21,
|
.minute = 21,
|
||||||
.second = 22,
|
.second = 22,
|
||||||
.tz = TimeZone.new(-5, null).?,
|
.tz = TimeZone.new(-5, null).?,
|
||||||
|
Loading…
Reference in New Issue
Block a user