diff options
author | Andrey Nering <andrey.nering@gmail.com> | 2017-03-30 19:14:16 -0300 |
---|---|---|
committer | Andrey Nering <andrey.nering@gmail.com> | 2017-03-30 19:14:16 -0300 |
commit | a90ffffb1a84d79f3e08bd1c7b90ab2f565833a0 (patch) | |
tree | 26f46c06d80568b3cab62912348c04e9204c8f27 /models/issue_watch.go | |
parent | 18952c40f80d41d2edc582305265dbfe3b62120d (diff) | |
download | gitea-a90ffffb1a84d79f3e08bd1c7b90ab2f565833a0.tar.gz gitea-a90ffffb1a84d79f3e08bd1c7b90ab2f565833a0.zip |
Use variables for times
Diffstat (limited to 'models/issue_watch.go')
-rw-r--r-- | models/issue_watch.go | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/models/issue_watch.go b/models/issue_watch.go index c48f05b114..8262ae2ea1 100644 --- a/models/issue_watch.go +++ b/models/issue_watch.go @@ -22,16 +22,24 @@ type IssueWatch struct { // BeforeInsert is invoked from XORM before inserting an object of this type. func (iw *IssueWatch) BeforeInsert() { - iw.Created = time.Now() - iw.CreatedUnix = time.Now().Unix() - iw.Updated = time.Now() - iw.UpdatedUnix = time.Now().Unix() + var ( + t = time.Now() + u = t.Unix() + ) + iw.Created = t + iw.CreatedUnix = u + iw.Updated = t + iw.UpdatedUnix = u } // BeforeUpdate is invoked from XORM before updating an object of this type. func (iw *IssueWatch) BeforeUpdate() { - iw.Updated = time.Now() - iw.UpdatedUnix = time.Now().Unix() + var ( + t = time.Now() + u = t.Unix() + ) + iw.Updated = t + iw.UpdatedUnix = u } // CreateOrUpdateIssueWatch set watching for a user and issue |