commit f931e578cf895123235182962fc4fc70b5f24d70
parent 98ef4820f40851c1fcd54d7a34c9976cedf6c998
Author: Byron Torres <b@torresjrjr.com>
Date: Thu, 20 Apr 2023 17:43:23 +0100
Revert "time::chrono: incorporate zone offset in in() and to_instant()"
This reverts commit 6aded183166b764a557b324d1dfd0bc58e3db08b.
This was incorrect. A later "overhaul" patch reimplements zone offsets.
Diffstat:
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/time/chrono/chronology.ha b/time/chrono/chronology.ha
@@ -56,10 +56,9 @@ export fn from_instant(i: time::instant, loc: locality) moment = {
// Creates a new [[time::instant]] from a [[moment]].
export fn to_instant(m: moment) time::instant = {
const daysec = (m.loc.daylength / time::SECOND);
- const t = m.time + m.zone.zoffset;
const i = time::instant {
- sec = (m.date: i64 * daysec) + (t / time::SECOND),
- nsec = t % time::SECOND,
+ sec = (m.date: i64 * daysec) + (m.time / time::SECOND),
+ nsec = m.time % time::SECOND,
};
return i;
};
diff --git a/time/chrono/timezone.ha b/time/chrono/timezone.ha
@@ -96,7 +96,7 @@ export fn in(loc: locality, m: moment) moment = {
};
assert(m.time < loc.daylength, "Internal error: time excedes daylength");
- return new(loc, m.date, m.time + m.zone.zoffset)!; // resets .zone
+ return new(loc, m.date, m.time)!; // resets .zone
};
export fn transform(m: moment, zo: time::duration) moment = {