Skip to main content

ito_core/
time.rs

1//! Clock helpers for the application layer.
2//!
3//! These live in `ito-core` rather than `ito-domain` because they depend on the
4//! system clock (`Local::now()`), which is non-deterministic I/O.
5
6use chrono::Local;
7
8/// Current local time formatted as `HH:MM:SS`.
9pub fn now_time() -> String {
10    Local::now().format("%H:%M:%S").to_string()
11}
12
13/// Current local date formatted as `YYYY-MM-DD`.
14pub fn now_date() -> String {
15    Local::now().format("%Y-%m-%d").to_string()
16}