summaryrefslogtreecommitdiffstats
path: root/src/time.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/time.rs')
-rw-r--r--src/time.rs7
1 files changed, 0 insertions, 7 deletions
diff --git a/src/time.rs b/src/time.rs
index b5f077e..8460f20 100644
--- a/src/time.rs
+++ b/src/time.rs
@@ -1,6 +1,5 @@
use chrono::{DateTime, SecondsFormat, TimeZone, Utc};
-/// Current time as a canonical DB timestamp: `2026-11-17T20:43:24Z`.
pub fn now() -> String {
match pinned() {
Some(pinned) => pinned,
@@ -8,10 +7,6 @@ pub fn now() -> String {
}
}
-/// The instant relative arithmetic should use, which is what makes `secs_ago`
-/// and `secs_ahead` honest under a pinned clock (ยง6 m-1): a pinned test asking
-/// for a 90-second lease means 90 seconds after *the pinned instant*, not after
-/// the real one.
fn base() -> DateTime<Utc> {
match pinned().and_then(|p| parse(&p)) {
Some(t) => t,
@@ -31,7 +26,6 @@ thread_local! {
static CLOCK: std::cell::RefCell<Option<String>> = const { std::cell::RefCell::new(None) };
}
-/// Pin the clock for the current thread (tests only). Returns the previous value.
pub fn pin(ts: &str) -> Option<String> {
CLOCK.with(|c| {
let mut slot = c.borrow_mut();
@@ -58,7 +52,6 @@ pub fn delta_secs(a: &str, b: &str) -> Option<i64> {
Some(parse(b)?.signed_duration_since(parse(a)?).num_seconds())
}
-/// A timestamp `secs` from [`base`], canonical format.
pub fn secs_ago(secs: i64) -> String {
fmt(base() - chrono::Duration::seconds(secs))
}