Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
20812c49
Commit
20812c49
authored
Jan 18, 2012
by
Sameer Ajmani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
13 deletions
+19
-13
src/pkg/time/time.go
src/pkg/time/time.go
+19
-13
No files found.
src/pkg/time/time.go
View file @
20812c49
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment