Browse Source

Reexport chrono duration

master
Alex Mikhalev 4 years ago
parent
commit
a998b3856b
  1. 6
      sprinklers_core/src/schedule.rs

6
sprinklers_core/src/schedule.rs

@ -1,13 +1,15 @@
//! Scheduling for events to run at certain intervals in the future //! Scheduling for events to run at certain intervals in the future
use chrono::{ use chrono::{
Date, DateTime, Datelike, Duration as CDuration, Local, NaiveDateTime, NaiveTime, TimeZone, Date, DateTime, Datelike, Local, NaiveDateTime, NaiveTime, TimeZone,
Weekday, Weekday,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::cmp; use std::cmp;
use std::iter::FromIterator; use std::iter::FromIterator;
pub use chrono::Duration;
/// A set of times of day (for [Schedule](struct.Schedule.html)) /// A set of times of day (for [Schedule](struct.Schedule.html))
pub type TimeSet = Vec<NaiveTime>; pub type TimeSet = Vec<NaiveTime>;
/// A set of days of week (for [Schedule](struct.Schedule.html)) /// A set of days of week (for [Schedule](struct.Schedule.html))
@ -380,7 +382,7 @@ impl Schedule {
.and_time(*time) .and_time(*time)
.map(|date| { .map(|date| {
if date < reference { if date < reference {
date + CDuration::weeks(1) date + Duration::weeks(1)
} else { } else {
date date
} }

Loading…
Cancel
Save