Commit 20812c49 authored by Sameer Ajmani's avatar Sameer Ajmani

time: add Since, which returns the time elapsed since some past time t.

R=rsc, r
CC=golang-dev
https://golang.org/cl/5532088
parent dbebb086
......@@ -566,6 +566,12 @@ func (t Time) Sub(u Time) Duration {
return Duration(t.sec-u.sec)*Second + Duration(t.nsec-u.nsec)
}
// Since returns the time elapsed since t.
// It is shorthand for time.Now().Sub(t).
func Since(t Time) Duration {
return Now().Sub(t)
}
// 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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment