summaryrefslogtreecommitdiffstats
path: root/src/time.rs
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-19 17:33:17 +0000
committeraur-build <aur-build@localhost>2026-11-19 17:33:17 +0000
commit4304b0f336ddba7b4ec6780795059ff2066d105b (patch)
tree10edea744a1c2bf3fc363b4dc7f64abac8b1a0d3 /src/time.rs
parente757979f1a2afdbe7146066345bb9acd19d3b151 (diff)
downloadaur-build-4304b0f336ddba7b4ec6780795059ff2066d105b.tar.gz
aur-build-4304b0f336ddba7b4ec6780795059ff2066d105b.zip
comments: keep only what the code cannot show
Stripped every comment that described what an item does, documented its arguments or fields, or cited the design docs (§n, I-n, m-n, decision n). 2247 comments down to 83. What survives: the section dividers that segment the large modules, the secret-handling warnings, the agent wire-frame directions, and the few notes without which the code they attach to reads as redundant, reorderable, or unsound.
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))
}