From 47aeb83da2a7ab15a2f500daeadfb95403c17b98 Mon Sep 17 00:00:00 2001 From: ice_iix Date: Sat, 29 Sep 2018 20:01:13 -0700 Subject: [PATCH] Use std::time instead of time crate for logo text, progress on https://github.com/iceiix/steven/issues/3 --- src/ui/logo.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ui/logo.rs b/src/ui/logo.rs index af6321e..ce24a0e 100644 --- a/src/ui/logo.rs +++ b/src/ui/logo.rs @@ -4,7 +4,7 @@ use std::f64::consts; use ui; use render; use resources; -use time; +use std::time::{SystemTime, UNIX_EPOCH}; use rand; use rand::Rng; @@ -134,10 +134,10 @@ impl Logo { } pub fn tick(&mut self, renderer: &mut render::Renderer) { - let now = time::now().to_timespec(); + let now = SystemTime::now().duration_since(UNIX_EPOCH).unwrap(); // Splash text - let text_index = (now.sec / 15) as isize % self.text_strings.len() as isize; + let text_index = (now.as_secs() / 15) as isize % self.text_strings.len() as isize; let mut text = self.text.borrow_mut(); if self.text_index != text_index { self.text_index = text_index; @@ -151,7 +151,7 @@ impl Logo { self.text_orig_x = text.x; } - let timer = now.nsec as f64 / 1000000000.0; + let timer = now.subsec_nanos() as f64 / 1000000000.0; let mut offset = timer / 0.5; if offset > 1.0 { offset = 2.0 - offset;