diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-08-15 22:46:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-15 22:46:21 +0800 |
commit | 85202d4784758573f80f93dbbda97a444e7ece99 (patch) | |
tree | 7957506de8657463e79f121e1b79567ef1cc84a1 /models/repo_mirror.go | |
parent | 5a44be627c055d3e9eb406ec4a91579de78b6910 (diff) | |
download | gitea-85202d4784758573f80f93dbbda97a444e7ece99.tar.gz gitea-85202d4784758573f80f93dbbda97a444e7ece99.zip |
Display ui time with customize time location (#7792)
* display ui time with customize time location
* fix lint
* rename UILocation to DefaultUILocation
* move time related functions to modules/timeutil
* fix tests
* fix tests
* fix build
* fix swagger
Diffstat (limited to 'models/repo_mirror.go')
-rw-r--r-- | models/repo_mirror.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/models/repo_mirror.go b/models/repo_mirror.go index 528e9daa8b..7f703a1c97 100644 --- a/models/repo_mirror.go +++ b/models/repo_mirror.go @@ -16,6 +16,7 @@ import ( "code.gitea.io/gitea/modules/process" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/sync" + "code.gitea.io/gitea/modules/timeutil" "code.gitea.io/gitea/modules/util" "github.com/Unknwon/com" @@ -34,8 +35,8 @@ type Mirror struct { Interval time.Duration EnablePrune bool `xorm:"NOT NULL DEFAULT true"` - UpdatedUnix util.TimeStamp `xorm:"INDEX"` - NextUpdateUnix util.TimeStamp `xorm:"INDEX"` + UpdatedUnix timeutil.TimeStamp `xorm:"INDEX"` + NextUpdateUnix timeutil.TimeStamp `xorm:"INDEX"` address string `xorm:"-"` } @@ -43,8 +44,8 @@ type Mirror struct { // BeforeInsert will be invoked by XORM before inserting a record func (m *Mirror) BeforeInsert() { if m != nil { - m.UpdatedUnix = util.TimeStampNow() - m.NextUpdateUnix = util.TimeStampNow() + m.UpdatedUnix = timeutil.TimeStampNow() + m.NextUpdateUnix = timeutil.TimeStampNow() } } @@ -64,7 +65,7 @@ func (m *Mirror) AfterLoad(session *xorm.Session) { // ScheduleNextUpdate calculates and sets next update time. func (m *Mirror) ScheduleNextUpdate() { if m.Interval != 0 { - m.NextUpdateUnix = util.TimeStampNow().AddDuration(m.Interval) + m.NextUpdateUnix = timeutil.TimeStampNow().AddDuration(m.Interval) } else { m.NextUpdateUnix = 0 } @@ -277,7 +278,7 @@ func (m *Mirror) runSync() ([]*mirrorSyncResult, bool) { cache.Remove(m.Repo.GetCommitsCountCacheKey(branches[i].Name, true)) } - m.UpdatedUnix = util.TimeStampNow() + m.UpdatedUnix = timeutil.TimeStampNow() return parseRemoteUpdateOutput(output), true } |