Skip to content

SystemTime::duration_since nightly regression #146228

@stepancheg

Description

@stepancheg
use std::time::SystemTime;
use std::time::Duration;

fn main() {
    let t = SystemTime::UNIX_EPOCH;
    let early = t - (Duration::from_secs(i64::MAX as u64 + 1));
    let later = t + (Duration::from_secs(i64::MAX as u64) + Duration::from_nanos(999_999_999));
    let delta = later.duration_since(early).unwrap();
    eprintln!("{early:?}");
    eprintln!("{delta:?}");
}

works on stable (1.89.0) and beta (1.90.0-beta.7 (2025-08-29 fb918ce)), but returns error on nightly (1.91.0-nightly (2025-09-04 af00ff2)).

Play

Probably introduced in #144519 (CC @clarfonthey).

Metadata

Metadata

Assignees

Labels

A-timeArea: TimeC-bugCategory: This is a bug.P-highHigh priorityT-libsRelevant to the library team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions