winbrew_core/time.rs
1//! Time helpers used by persistence and reporting code.
2//!
3//! The model and storage layers use these helpers to keep timestamps in one
4//! canonical format and to avoid scattering raw chrono calls across call sites.
5
6use chrono::Utc;
7
8/// Return the current UTC timestamp in RFC 3339 second precision.
9pub fn now() -> String {
10 Utc::now().format("%Y-%m-%dT%H:%M:%SZ").to_string()
11}
12
13/// Return the current UTC timestamp as milliseconds since the Unix epoch.
14pub fn now_ms() -> i64 {
15 Utc::now().timestamp_millis()
16}