1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 13:20:05 -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:
Emil Ernerfeldt
2021-10-19 15:37:20 +02:00
parent cdd4dccf5f
commit 844dd9d7a4
17 changed files with 27 additions and 64 deletions

View File

@@ -227,7 +227,6 @@ impl AppRunner {
}),
prefer_dark_mode: self.prefer_dark_mode,
cpu_usage: self.web_backend.previous_frame_time,
seconds_since_midnight: Some(seconds_since_midnight()),
native_pixels_per_point: Some(native_pixels_per_point()),
}
}

View File

@@ -62,12 +62,6 @@ pub fn now_sec() -> f64 {
/ 1000.0
}
pub fn seconds_since_midnight() -> f64 {
let d = js_sys::Date::new_0();
let seconds = (d.get_hours() * 60 + d.get_minutes()) * 60 + d.get_seconds();
seconds as f64 + 1e-3 * (d.get_milliseconds() as f64)
}
pub fn screen_size_in_native_points() -> Option<egui::Vec2> {
let window = web_sys::window()?;
Some(egui::Vec2::new(