1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 13:50: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:
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

@@ -164,7 +164,6 @@ fn integration_info(
web_info: None,
prefer_dark_mode: None, // TODO: figure out system default
cpu_usage: previous_frame_time,
seconds_since_midnight: seconds_since_midnight(),
native_pixels_per_point: Some(native_pixels_per_point(window)),
}
}

View File

@@ -89,20 +89,6 @@ pub use epi::NativeOptions;
// ----------------------------------------------------------------------------
/// Time of day as seconds since midnight. Used for clock in demo app.
pub fn seconds_since_midnight() -> Option<f64> {
#[cfg(feature = "time")]
{
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 = "time"))]
None
}
pub fn screen_size_in_pixels(window: &glutin::window::Window) -> egui::Vec2 {
let glutin::dpi::PhysicalSize { width, height } = window.inner_size();
egui::vec2(width as f32, height as f32)