commit 26db325621d392eda4a4878609735c82949d6d94
parent 8cc05645611bce3cae5fe8568b095f90362f79f3
Author: Byron Torres <b@torresjrjr.com>
Date: Thu, 22 Feb 2024 23:44:01 +0000
time::chrono: rename path constant exports
Rename [[ZONEINFO_PREFIX]] to [[TZDB_PATH]]
as "zoneinfo" is merely a convention.
Rename [[UTC_LEAPSECS_FILE]] to [[UTC_LEAPSECS_PATH]]
for consistency.
Breaking-Change: 0.24.0
Signed-off-by: Byron Torres <b@torresjrjr.com>
Diffstat:
6 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/time/chrono/+freebsd.ha b/time/chrono/+freebsd.ha
@@ -2,8 +2,8 @@
// (c) Hare authors <https://harelang.org>
def LOCALTIME_PATH: str = "/etc/localtime";
-def ZONEINFO_PREFIX: str = "/usr/share/zoneinfo/";
+def TZDB_PATH: str = "/usr/share/zoneinfo/";
// The filepath of the system's "leap-seconds.list" file, which contains UTC/TAI
// leap second data.
-export def UTC_LEAPSECS_FILE: str = "/var/db/ntpd.leap-seconds.list";
+export def UTC_LEAPSECS_PATH: str = "/var/db/ntpd.leap-seconds.list";
diff --git a/time/chrono/+linux.ha b/time/chrono/+linux.ha
@@ -2,8 +2,8 @@
// (c) Hare authors <https://harelang.org>
def LOCALTIME_PATH: str = "/etc/localtime";
-def ZONEINFO_PREFIX: str = "/usr/share/zoneinfo/";
+def TZDB_PATH: str = "/usr/share/zoneinfo/";
// The filepath of the system's "leap-seconds.list" file, which contains UTC/TAI
// leap second data.
-export def UTC_LEAPSECS_FILE: str = "/usr/share/zoneinfo/leap-seconds.list";
+export def UTC_LEAPSECS_PATH: str = "/usr/share/zoneinfo/leap-seconds.list";
diff --git a/time/chrono/+openbsd.ha b/time/chrono/+openbsd.ha
@@ -2,8 +2,8 @@
// (c) Hare authors <https://harelang.org>
def LOCALTIME_PATH: str = "/etc/localtime";
-def ZONEINFO_PREFIX: str = "/usr/share/zoneinfo/";
+def TZDB_PATH: str = "/usr/share/zoneinfo/";
// The filepath of the system's "leap-seconds.list" file, which contains UTC/TAI
// leap second data.
-export def UTC_LEAPSECS_FILE: str = "/usr/share/zoneinfo/leap-seconds.list";
+export def UTC_LEAPSECS_PATH: str = "/usr/share/zoneinfo/leap-seconds.list";
diff --git a/time/chrono/leapsec.ha b/time/chrono/leapsec.ha
@@ -38,7 +38,7 @@ type utciniterror = !(fs::error | io::error | utf8::invalid);
export def SECS_1900_1970: i64 = 2208988800;
// UTC/TAI leap second data; UTC timestamps and their offsets from TAI.
-// Sourced from [[UTC_LEAPSECS_FILE]].
+// Sourced from [[UTC_LEAPSECS_PATH]].
let utc_leapsecs: [](i64, i64) = [];
let utc_isinitialized: bool = false;
@@ -48,12 +48,12 @@ let utc_isinitialized: bool = false;
};
fn init_utc_leapsecs() (void | utciniterror) = {
- const file = os::open(UTC_LEAPSECS_FILE)?;
+ const file = os::open(UTC_LEAPSECS_PATH)?;
defer io::close(file)!;
parse_utc_leapsecs(file)?;
};
-// Parse UTC/TAI leap second data from [[UTC_LEAPSECS_FILE]].
+// Parse UTC/TAI leap second data from [[UTC_LEAPSECS_PATH]].
// See file for format details.
fn parse_utc_leapsecs(h: io::handle) (void | utf8::invalid | io::error) = {
for (true) {
diff --git a/time/chrono/timescale.ha b/time/chrono/timescale.ha
@@ -104,7 +104,7 @@ fn tai_conv(ts: *timescale, i: time::instant) ([]time::instant | void) = {
// Discontinuous (has leap seconds).
//
// During a program's initialization, this timescale initializes by loading its
-// UTC/TAI leap second data from [[UTC_LEAPSECS_FILE]]; otherwise, fails
+// UTC/TAI leap second data from [[UTC_LEAPSECS_PATH]]; otherwise, fails
// silently. If failed, any attempt to consult UTC leapsec data (e.g. calling
// [[convert]] on UTC) causes an abort. This includes [[in]].
export const utc: timescale = timescale {
diff --git a/time/chrono/tzdb.ha b/time/chrono/tzdb.ha
@@ -22,7 +22,7 @@ export type invalidtzif = !void;
// database (TZDB), and returns it as a [[locality]]. Each call returns a new
// instance. The caller must free the return value; see [[timezone_free]].
//
-// The system TZDB is normally located at [[ZONEINFO_PREFIX]]. The timezone
+// The system TZDB is normally located at [[TZDB_PATH]]. The timezone
// filepath is resolved by appending the name argument to this prefix path.
// If [name] is a full filepath (begins with '/'), it is used directly instead.
//
@@ -30,8 +30,8 @@ export type invalidtzif = !void;
// [[EARTH_DAY]] day-length.
export fn tz(name: str) (locality | tzdberror) = {
const filepath =
- if (!strings::hasprefix(name, ZONEINFO_PREFIX))
- path::init(ZONEINFO_PREFIX, name)!
+ if (!strings::hasprefix(name, TZDB_PATH))
+ path::init(TZDB_PATH, name)!
else
path::init(name)!;
const file = os::open(path::string(&filepath))?;