diff --git a/src/widgets/clock.rs b/src/widgets/clock.rs index f503ae4..1620500 100644 --- a/src/widgets/clock.rs +++ b/src/widgets/clock.rs @@ -2,7 +2,7 @@ use crate::color::Color; use crate::draw::{Font, ROBOTO_REGULAR}; use crate::widget::{DrawContext, DrawReport, KeyState, ModifiersState, WaitContext, Widget}; -use chrono::{DateTime, Datelike, Duration, Local, Timelike}; +use chrono::{DateTime, Duration, Local, Timelike}; pub struct Clock { cur_time: DateTime, @@ -15,10 +15,8 @@ impl Clock { let mut clock_cache = Font::new(&ROBOTO_REGULAR, size); clock_cache.add_str_to_cache("0123456789:"); - let time = Local::now(); - Box::new(Clock { - cur_time: time.with_year(time.year().saturating_sub(1)).unwrap(), + cur_time: Local::now(), clock_cache: clock_cache, size: size, }) diff --git a/src/widgets/date.rs b/src/widgets/date.rs index 1264653..05364bb 100644 --- a/src/widgets/date.rs +++ b/src/widgets/date.rs @@ -16,10 +16,8 @@ impl Date { date_cache .add_str_to_cache("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,/ "); - let time = Local::now(); - Box::new(Date { - cur_time: time.with_year(time.year().saturating_sub(1)).unwrap(), + cur_time: Local::now(), date_cache: date_cache, size: size, })