Skip to main content

kobo_core/device/
clock.rs

1// SPDX-License-Identifier: MIT
2// Copyright (c) 2026 Nayeem Bin Ahsan
3//! Wall-clock time for the on-screen clock (shells out to `date` for the
4//! locale-correct 12-hour format).
5
6use std::process::Command;
7
8pub fn current_clock() -> String {
9    Command::new("date")
10        .args(["+%-I:%M %p"])
11        .output()
12        .ok()
13        .and_then(|o| String::from_utf8(o.stdout).ok())
14        .map(|s| s.trim().to_string())
15        .unwrap_or_else(|| "--:--".to_string())
16}