generated from emilk/eframe_template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replaced time-rs with chrono. Much better user experience with format…
…ting.
- Loading branch information
Showing
11 changed files
with
82 additions
and
101 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,4 +25,4 @@ impl FromWorld for Icons { | |
fort, | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,12 @@ | ||
use bevy::prelude::*; | ||
use time::{OffsetDateTime, UtcOffset}; | ||
use chrono::{DateTime, Local}; | ||
|
||
use crate::resources::ChronoSphere; | ||
|
||
pub fn get_local_now() -> OffsetDateTime { | ||
match OffsetDateTime::now_local() { | ||
Ok(val) => val, | ||
Err(_) => OffsetDateTime::now_utc().to_offset( | ||
UtcOffset::from_hms(-3, 0, 0).expect( | ||
"IndeterminateOffset for `now_local()`, plus manual setting of offset did not work." | ||
) | ||
), | ||
} | ||
pub fn get_local_now() -> DateTime<Local> { | ||
Local::now() | ||
} | ||
|
||
pub fn update_chronosphere(mut chronos: ResMut<ChronoSphere>) { | ||
let now = get_local_now(); | ||
chronos.now = now; | ||
chronos.weekday = now.weekday(); | ||
chronos.hh = now.time().hour(); | ||
chronos.mm = now.time().minute(); | ||
pub fn update_chronosphere(mut chrono: ResMut<ChronoSphere>) { | ||
chrono.now = get_local_now(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters