Skip to content

Commit

Permalink
std/time: add the Until function
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Nov 28, 2024
1 parent 5b09dc9 commit 23cda9b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions std/time/time.jule
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,12 @@ fn Since(t: Time): Duration {
ret Now().Sub(t)
}

// Returns the duration until t.
// It is shorthand for t.Sub(time::Now()).
fn Until(t: Time): Duration {
ret t.Sub(Now())
}

// Absolute time.
struct AbsTime {
Day: int
Expand Down

0 comments on commit 23cda9b

Please sign in to comment.