mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 14:20:04 -04:00
Remove "seconds_since_midnight" from epi/eframe. Use chrono instead
chrono works both natively and on web. Related: https://github.com/emilk/egui/issues/212
This commit is contained in:
@@ -154,3 +154,19 @@ fn test_egui_zero_window_size() {
|
||||
assert!(clipped_meshes.is_empty(), "There should be nothing to show");
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/// Time of day as seconds since midnight. Used for clock in demo app.
|
||||
pub(crate) fn seconds_since_midnight() -> Option<f64> {
|
||||
#[cfg(feature = "chrono")]
|
||||
{
|
||||
use chrono::Timelike;
|
||||
let time = chrono::Local::now().time();
|
||||
let seconds_since_midnight =
|
||||
time.num_seconds_from_midnight() as f64 + 1e-9 * (time.nanosecond() as f64);
|
||||
Some(seconds_since_midnight)
|
||||
}
|
||||
#[cfg(not(feature = "chrono"))]
|
||||
None
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user