diff --git a/src/time/time.go b/src/time/time.go index c31de357d5..a6e100fa71 100644 --- a/src/time/time.go +++ b/src/time/time.go @@ -640,6 +640,12 @@ func Since(t Time) Duration { return Now().Sub(t) } +// Until returns the duration until t. +// It is shorthand for t.Sub(time.Now()). +func Until(t Time) Duration { + return t.Sub(Now()) +} + // AddDate returns the time corresponding to adding the // given number of years, months, and days to t. // For example, AddDate(-1, 2, 3) applied to January 1, 2011