diff --git a/rslib/src/import_export/gather.rs b/rslib/src/import_export/gather.rs index 028a142a7..8a3fa4999 100644 --- a/rslib/src/import_export/gather.rs +++ b/rslib/src/import_export/gather.rs @@ -123,14 +123,14 @@ impl ExchangeData { } fn check_ids(&self) -> Result<()> { - let now = TimestampMillis::now().0; + let tomorrow = TimestampMillis::now().adding_secs(86_400).0; if self .cards .iter() .map(|card| card.id.0) .chain(self.notes.iter().map(|note| note.id.0)) .chain(self.revlog.iter().map(|entry| entry.id.0)) - .any(|timestamp| timestamp > now) + .any(|timestamp| timestamp > tomorrow) { Err(AnkiError::InvalidId) } else { diff --git a/rslib/src/timestamp.rs b/rslib/src/timestamp.rs index ba07167a5..31b9b5cbd 100644 --- a/rslib/src/timestamp.rs +++ b/rslib/src/timestamp.rs @@ -80,6 +80,10 @@ impl TimestampMillis { pub fn as_secs(self) -> TimestampSecs { TimestampSecs(self.0 / 1000) } + + pub fn adding_secs(self, secs: i64) -> Self { + Self(self.0 + secs * 1000) + } } fn elapsed() -> time::Duration {