Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Uriopass committed Feb 5, 2024
1 parent 2101246 commit bfe4335
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Paris DOUADY <[email protected]>"]
edition = "2021"

[lib]
crate-type = ["dylib"]
crate-type = ["rlib", "dylib"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
5 changes: 3 additions & 2 deletions prototypes/src/types/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ impl DayTime {
/// Creates a new DayTime from the number of seconds elapsed since the start of the game
pub fn new(seconds: i32) -> DayTime {
DayTime {
day: 1 + seconds / SECONDS_PER_DAY,
day: seconds / SECONDS_PER_DAY,
hour: (seconds % SECONDS_PER_DAY) / SECONDS_PER_HOUR,
minute: (seconds % SECONDS_PER_HOUR) / SECONDS_PER_MINUTE,
second: seconds % SECONDS_PER_MINUTE,
Expand Down Expand Up @@ -217,7 +217,8 @@ impl GameTime {
pub const DAY: i32 = SECONDS_PER_DAY;

pub fn new(tick: Tick) -> GameTime {
let timestamp = (tick.0 as f64 + 8.0 * TICKS_PER_HOUR as f64) / TICKS_PER_SECOND as f64;
let timestamp = Self::DAY as f64
+ (tick.0 as f64 + 8.0 * TICKS_PER_HOUR as f64) / TICKS_PER_SECOND as f64;
let seconds = timestamp as u32;

GameTime {
Expand Down

0 comments on commit bfe4335

Please sign in to comment.