1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 22:00:03 -04:00

Add a fractal clock example to showcase painting performance

This commit is contained in:
Emil Ernerfeldt
2020-05-11 20:21:24 +02:00
parent 5a9e3d62bf
commit 71154edf9b
21 changed files with 425 additions and 37 deletions

View File

@@ -195,3 +195,12 @@ pub fn write_memory(
serde_json::to_writer_pretty(std::fs::File::create(memory_json_path)?, &*ctx.memory())?;
Ok(())
}
// ----------------------------------------------------------------------------
/// Time of day as seconds since midnight. Used for clock in example app.
pub fn local_time_of_day() -> f64 {
use chrono::Timelike;
let time = chrono::Local::now().time();
time.num_seconds_from_midnight() as f64 + 1e-9 * (time.nanosecond() as f64)
}