hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 55833e711d310b7be3658b77f27d2ca1bb7be152
parent e624ff3b59a9781ce1053e481c36d0ff1d2e6be8
Author: Byron Torres <b@torresjrjr.com>
Date:   Sat, 13 May 2023 02:12:06 +0100

time: rename datetime module in READMEs, docs

Diffstat:
Mtime/README | 6+++---
Mtime/chrono/README | 6+++---
Mtime/date/README | 2+-
Mtime/date/datetime.ha | 14+++++++-------
Mtime/date/format.ha | 18+++++++++---------
Mtime/date/parse.ha | 6+++---
Mtime/date/reckon.ha | 4++--
Mtime/date/virtual.ha | 6+++---
8 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/time/README b/time/README @@ -1,3 +1,3 @@ -The time module provides basic timekeeping primitives and access to the -system's clocks. See [[time::chrono]] for incorporating human timescales and -[[datetime]] for working with the ISO 8601 Gregorian calendar. +The time module provides basic timekeeping primitives and system clock access. +See [[time::chrono]] for timescales, timezones, and other chronology primitives. +See [[time::date]] for the Gregorian chronology. diff --git a/time/chrono/README b/time/chrono/README @@ -2,7 +2,7 @@ The time::chrono submodule provides the basis for chronology in Hare, namely [[timescale]]s (leap second handling), [[timezone]]s, and the [[moment]] type, an abstracted date/time object for external modules to interface with. -For working with the ISO 8601 Gregorian calendar, see the [[datetime]] module. +For working with the Gregorian chronology, see the [[time::date]] module. Hare defines a chronology as a system used to name and order moments in time. In practice, a chronology is the combination of a calendar (for handling days) and @@ -12,8 +12,8 @@ This module implements a small chronology of dates & times. A moment observes certain chronological values according to its [[locality]]. The "observe" functions [[date]], [[time]], and [[zone]] obtain these values. -Higher level modules like [[datetime]] expand upon this with more complex -chronological values (years, hours, etc.). The [[datetime::datetime]] type +Higher level modules like [[time::date]] expand upon this with more complex +chronological values (years, hours, etc.). The [[time::date::datetime]] type embeds [[moment]], and other modules implementing other chronologies may interoperate with their own extension types. diff --git a/time/date/README b/time/date/README @@ -1,4 +1,4 @@ -The datetime module implements the common international "Gregorian" chronology, +The time::date module implements the common international Gregorian chronology, based on the astronomically numbered proleptic Gregorian calendar, as per ISO 8601, and the common 24 hour clock. It provides [[datetime]], a representation of civil date/time and an extension of the [[time::chrono::moment]] type, diff --git a/time/date/datetime.ha b/time/date/datetime.ha @@ -97,13 +97,13 @@ fn all(dt: *datetime) *datetime = { // an abort. // // // 0000-01-01 00:00:00.000000000 +0000 UTC UTC -// datetime::new(time::chrono::UTC, 0); +// date::new(time::chrono::UTC, 0); // // // 2019-12-27 20:07:08.000031415 +0000 UTC UTC -// datetime::new(time::chrono::UTC, 0, 2019, 12, 27, 20, 07, 08, 31415); +// date::new(time::chrono::UTC, 0, 2019, 12, 27, 20, 07, 08, 31415); // // // 2019-12-27 21:00:00.000000000 +0100 CET Europe/Amsterdam -// datetime::new(time::chrono::tz("Europe/Amsterdam")!, 1 * time::HOUR, +// date::new(time::chrono::tz("Europe/Amsterdam")!, 1 * time::HOUR, // 2019, 12, 27, 21); // // 'zo' is the zone offset from the normal timezone (in most cases, UTC). For @@ -142,7 +142,7 @@ export fn new( ]; assert(len(fields) <= len(_fields), - "datetime::new(): Too many field arguments"); + "time::date::new(): Too many field arguments"); _fields[..len(fields)] = fields; const year = _fields[0]; @@ -166,7 +166,7 @@ export fn new( // perform a zone lookup, then try that zone and the zones that // are observed before and after. This requires knowlegde of the // transition index. - abort("TODO: datetime::new(zo=void)"); + abort("TODO: time::date::new(zo=void)"); }; const dt = from_moment(m); @@ -230,8 +230,8 @@ export fn from_instant(loc: chrono::locality, i: time::instant) datetime = { // provided. The if hour, minute, second, nanosecond, or zone offset are not // provided, they default to 0. // -// let new = datetime::from_str( -// datetime::STAMP_NOZL, +// let new = date::from_str( +// date::STAMP_NOZL, // "2019-12-27 22:07:08.000000000 +0100 CET Europe/Amsterdam", // locs... // )!; diff --git a/time/date/format.ha b/time/date/format.ha @@ -11,32 +11,32 @@ use strio; use time; use time::chrono; -// [[datetime::format]] layout for the email date format. +// [[format]] layout for the email date format. export def EMAIL: str = "%a, %d %b %Y %H:%M:%S %z"; -// [[datetime::format]] layout for the email date format, with zone offset and +// [[format]] layout for the email date format, with zone offset and // zone abbreviation. export def EMAILZ: str = "%a, %d %b %Y %H:%M:%S %z %Z"; -// [[datetime::format]] layout partly compatible with the default layout format +// [[format]] layout partly compatible with the default layout format // for the POSIX locale. %d is used in place of POSIX %e. export def POSIX: str = "%a %b %d %H:%M:%S %Z %Y"; // TODO: Actually implement '%e' and thus the POSIX layout format? -// [[datetime::format]] layout compatible with RFC 3339. +// [[format]] layout compatible with RFC 3339. export def RFC3339: str = "%Y-%m-%dT%H:%M:%S%z"; -// [[datetime::format]] layout for a simple timestamp. +// [[format]] layout for a simple timestamp. export def STAMP: str = "%Y-%m-%d %H:%M:%S"; -// [[datetime::format]] layout for a simple timestamp with nanoseconds. +// [[format]] layout for a simple timestamp with nanoseconds. export def STAMP_NANO: str = "%Y-%m-%d %H:%M:%S.%N"; -// [[datetime::format]] layout for a simple timestamp with nanoseconds and zone +// [[format]] layout for a simple timestamp with nanoseconds and zone // offset. export def STAMP_ZOFF: str = "%Y-%m-%d %H:%M:%S.%N %z"; -// [[datetime::format]] layout for a simple timestamp with nanoseconds, +// [[format]] layout for a simple timestamp with nanoseconds, // zone offset, zone abbreviation, and locality. export def STAMP_NOZL: str = "%Y-%m-%d %H:%M:%S.%N %z %Z %L"; @@ -162,7 +162,7 @@ fn fmtout(out: io::handle, r: rune, dt: *datetime) (size | io::error) = { case '%' => return fmt::fprint(out, "%"); case => - abort("Invalid format string provided to datetime::format"); + abort("Invalid format string provided to time::date::format"); }; }; diff --git a/time/date/parse.ha b/time/date/parse.ha @@ -21,9 +21,9 @@ export type parsefail = !rune; // string with specifiers as documented under [[format]]. Partial, sequential, // aggregative parsing is possible. // -// datetime::parse(&v, "%Y-%m-%d", "2019-12-27"); -// datetime::parse(&v, "%H:%M:%S.%N", "22:07:08.000000000"); -// datetime::parse(&v, "%z %Z %L", "+0100 CET Europe/Amsterdam"); +// date::parse(&v, "%Y-%m-%d", "2019-12-27"); +// date::parse(&v, "%H:%M:%S.%N", "22:07:08.000000000"); +// date::parse(&v, "%z %Z %L", "+0100 CET Europe/Amsterdam"); // // Parse will return parsefail, if an invalid format specifier is encountered // or if given string 's' does not match the layout. diff --git a/time/date/reckon.ha b/time/date/reckon.ha @@ -57,10 +57,10 @@ export type calculus = enum uint { // The [[calculus]] parameter determines arithmetic and resolution behaviour // when encountering deviations (e.g. overflows). // -// let dest = datetime::reckon( +// let dest = date::reckon( // start, // 2000-02-29 09:00:00 // 0, // calculus::DEFAULT -// datetime::period { +// date::period { // years = 1, // becomes: 2001-02-28 09:00:00 // months = -2, // becomes: 2000-12-28 09:00:00 // days = 4, // becomes: 2001-01-01 09:00:00 diff --git a/time/date/virtual.ha b/time/date/virtual.ha @@ -20,15 +20,15 @@ export type insufficient = !void; // [[newvirtual]], then collect enough date/time information incrementally by // direct field assignments and/or with [[parse]]. Finish with [[realize]]. // -// let v = datetime::newvirtual(); +// let v = date::newvirtual(); // v.vloc = time::chrono::UTC; // v.zoff = 0; -// datetime::parse(&v, "Date: %Y-%m-%d", "Date: 2038-01-19")!; +// date::parse(&v, "Date: %Y-%m-%d", "Date: 2038-01-19")!; // v.hour = 03; // v.minute = 14; // v.second = 07; // v.nanosecond = 0; -// let dt = datetime::realize(v)!; +// let dt = date::realize(v)!; // export type virtual = struct { datetime,