Fix Mnemosyne importer chokes on due dates >= 2038 (#3459)

* Fix integer overflow

* Update CONTRIBUTORS
This commit is contained in:
Ben Nguyen 2024-10-02 01:20:44 -07:00 committed by GitHub
parent 159681d9f2
commit cc45db0e22
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View file

@ -187,7 +187,7 @@ Christian Donat <https://github.com/cdonat2>
Asuka Minato <https://asukaminato.eu.org>
Dillon Baldwin <https://github.com/DillBal>
Voczi <https://github.com/voczi>
Ben Nguyen <105088397+bpnguyen107@users.noreply.github.com>
Ben Nguyen <105088397+bpnguyen107@users.noreply.github.com>
Themis Demetriades <themis100@outlook.com>
Luke Bartholomew <lukesbart@icloud.com>
Gregory Abrasaldo <degeemon@gmail.com>

View file

@ -635,9 +635,9 @@ impl ForeignCard {
}
fn native_due(self, timing: &SchedTimingToday) -> i32 {
let day_start = timing.next_day_at.0 as i32 - 86_400;
let day_start = timing.next_day_at.0 - 86_400;
let due_delta = (self.due - day_start) / 86_400;
due_delta + timing.days_elapsed as i32
due_delta as i32 + timing.days_elapsed as i32
}
}

View file

@ -40,7 +40,7 @@ pub struct ForeignNote {
#[serde(default)]
pub struct ForeignCard {
/// Seconds-based timestamp
pub due: i32,
pub due: i64,
/// In days
pub interval: u32,
pub ease_factor: f32,