commit 8cc05645611bce3cae5fe8568b095f90362f79f3
parent ccea3d200b636503b0072ef4352648de7632c90b
Author: Byron Torres <b@torresjrjr.com>
Date: Thu, 22 Feb 2024 23:44:00 +0000
time::chrono: rename mzone to ozone
Rename export [[time::chrono::mzone]] to [[time::chrono::ozone]].
Braking-Change: 0.24.0
Signed-off-by: Byron Torres <b@torresjrjr.com>
Diffstat:
6 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/time/chrono/chronology.ha b/time/chrono/chronology.ha
@@ -17,7 +17,7 @@ export type invalid = !void;
//
// Moments observe a daydate, time-of-day, and [[zone]], which are evaluated,
// cached and obtained with the observer functions [[daydate]], [[daytime]], and
-// [[mzone]]. These values are derived from the embedded instant and locality
+// [[ozone]]. These values are derived from the embedded instant and locality
// information, and thus are guaranteed to be valid.
export type moment = struct {
// The embedded [[time::instant]].
@@ -52,7 +52,7 @@ export fn new(loc: locality, i: time::instant) moment = {
};
// Observes a [[moment]]'s observed [[zone]].
-export fn mzone(m: *moment) zone = {
+export fn ozone(m: *moment) zone = {
match (m.zone) {
case let z: *zone =>
return *z;
@@ -75,7 +75,7 @@ export fn daydate(m: *moment) i64 = {
return dd;
case void =>
const (dd, dt) = calc_datetime(
- m.loc, *(m: *time::instant), mzone(m).zoff,
+ m.loc, *(m: *time::instant), ozone(m).zoff,
);
m.daytime = dt;
m.daydate = dd;
@@ -91,7 +91,7 @@ export fn daytime(m: *moment) i64 = {
return dt;
case void =>
const (dd, dt) = calc_datetime(
- m.loc, *(m: *time::instant), mzone(m).zoff,
+ m.loc, *(m: *time::instant), ozone(m).zoff,
);
m.daytime = dt;
m.daydate = dd;
diff --git a/time/date/date.ha b/time/date/date.ha
@@ -164,7 +164,7 @@ export fn new(
// check if input values are actually observed
if (
- zoff != chrono::mzone(&d).zoff
+ zoff != chrono::ozone(&d).zoff
|| _fields[0] != _year(&d)
|| _fields[1] != _month(&d)
|| _fields[2] != _day(&d)
diff --git a/time/date/format.ha b/time/date/format.ha
@@ -148,15 +148,15 @@ fn fmtout(out: io::handle, r: rune, d: *date) (size | io::error) = {
case 'Y' =>
return fmt::fprintf(out, "{:.4}", _year(d));
case 'z' =>
- const (sign, zo) = if (chrono::mzone(d).zoff >= 0) {
- yield ('+', calc_hmsn(chrono::mzone(d).zoff));
+ const (sign, zo) = if (chrono::ozone(d).zoff >= 0) {
+ yield ('+', calc_hmsn(chrono::ozone(d).zoff));
} else {
- yield ('-', calc_hmsn(-chrono::mzone(d).zoff));
+ yield ('-', calc_hmsn(-chrono::ozone(d).zoff));
};
const (hr, mi) = (zo.0, zo.1);
return fmt::fprintf(out, "{}{:.2}{:.2}", sign, hr, mi);
case 'Z' =>
- return fmt::fprint(out, chrono::mzone(d).abbr);
+ return fmt::fprint(out, chrono::ozone(d).abbr);
case '%' =>
return fmt::fprint(out, "%");
case =>
diff --git a/time/date/parithm.ha b/time/date/parithm.ha
@@ -131,44 +131,44 @@ export fn truncate(d: date, u: unit) date = {
// realize(), and then use realize() here.
return switch (u) {
case unit::ERA =>
- yield new(d.loc, chrono::mzone(&d).zoff,
+ yield new(d.loc, chrono::ozone(&d).zoff,
1, 1, 1,
0, 0, 0, 0,
)!;
case unit::YEAR =>
- yield new(d.loc, chrono::mzone(&d).zoff,
+ yield new(d.loc, chrono::ozone(&d).zoff,
_year(&d), 1, 1,
0, 0, 0, 0,
)!;
case unit::MONTH =>
- yield new(d.loc, chrono::mzone(&d).zoff,
+ yield new(d.loc, chrono::ozone(&d).zoff,
_year(&d), _month(&d), 1,
0, 0, 0, 0,
)!;
case unit::WEEK =>
const dd = chrono::daydate(&d) - _weekday(&d);
const ymd = calc_ymd(dd);
- yield new(d.loc, chrono::mzone(&d).zoff,
+ yield new(d.loc, chrono::ozone(&d).zoff,
ymd.0, ymd.1, ymd.2,
0, 0, 0, 0,
)!;
case unit::DAY =>
- yield new(d.loc, chrono::mzone(&d).zoff,
+ yield new(d.loc, chrono::ozone(&d).zoff,
_year(&d), _month(&d), _day(&d),
0, 0, 0, 0,
)!;
case unit::HOUR =>
- yield new(d.loc, chrono::mzone(&d).zoff,
+ yield new(d.loc, chrono::ozone(&d).zoff,
_year(&d), _month(&d), _day(&d),
_hour(&d), 0, 0, 0,
)!;
case unit::MINUTE =>
- yield new(d.loc, chrono::mzone(&d).zoff,
+ yield new(d.loc, chrono::ozone(&d).zoff,
_year(&d), _month(&d), _day(&d),
_hour(&d), _minute(&d), 0, 0,
)!;
case unit::SECOND =>
- yield new(d.loc, chrono::mzone(&d).zoff,
+ yield new(d.loc, chrono::ozone(&d).zoff,
_year(&d), _month(&d), _day(&d),
_hour(&d), _minute(&d), _second(&d), 0,
)!;
diff --git a/time/date/reckon.ha b/time/date/reckon.ha
@@ -70,7 +70,7 @@ export type calculus = enum uint {
export fn reckon(d: date, calc: calculus, ps: period...) date = {
let r = newvirtual(); // our reckoner
r.vloc = d.loc;
- r.zoff = chrono::mzone(&d).zoff;
+ r.zoff = chrono::ozone(&d).zoff;
r.year = _year(&d);
r.month = _month(&d);
r.day = _day(&d);
diff --git a/time/date/virtual.ha b/time/date/virtual.ha
@@ -217,7 +217,7 @@ export fn realize(
));
// verify zone offset
- const z = chrono::mzone(&d);
+ const z = chrono::ozone(&d);
if (z.zoff != v.zoff as time::duration) {
return invalid;
};