Skip to content

Commit

Permalink
Migrate away from deprecated time::Instant.
Browse files Browse the repository at this point in the history
  • Loading branch information
xStrom committed May 21, 2024
1 parent 8a4da49 commit 84f447e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions druid-shell/examples/perftest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

use std::any::Any;

use time::Instant;
use std::time::Instant;

use piet_common::kurbo::{Line, Size};
use piet_common::{Color, FontFamily, Piet, RenderContext, Text, TextLayoutBuilder};
Expand Down Expand Up @@ -42,7 +41,7 @@ impl WinHandler for PerfTest {
1.0,
);

let current_ns = (Instant::now() - self.start_time).whole_nanoseconds();
let current_ns = (Instant::now() - self.start_time).as_nanos();
let th = ::std::f64::consts::PI * (current_ns as f64) * 2e-9;
let dx = 100.0 * th.sin();
let dy = 100.0 * th.cos();
Expand All @@ -53,7 +52,7 @@ impl WinHandler for PerfTest {
);

let now = Instant::now();
let msg = format!("{}ms", (now - self.last_time).whole_milliseconds());
let msg = format!("{}ms", (now - self.last_time).as_millis());
self.last_time = now;
let layout = piet
.text()
Expand Down Expand Up @@ -131,8 +130,8 @@ fn main() {
let perf_test = PerfTest {
size: Size::ZERO,
handle: Default::default(),
start_time: time::Instant::now(),
last_time: time::Instant::now(),
start_time: Instant::now(),
last_time: Instant::now(),
red: true,
};
builder.set_handler(Box::new(perf_test));
Expand Down

0 comments on commit 84f447e

Please sign in to comment.