diff options
author | Unknwon <u@gogs.io> | 2016-03-09 19:53:30 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-03-09 19:53:30 -0500 |
commit | ad513a20e939691828ba415c9a565e8ff3daa95f (patch) | |
tree | c15aa2c82a5ed242ba51c837804f050690dd60ad /models/action.go | |
parent | 0c9a616326ba096a2ff6c058cc96950f68c0fa6e (diff) | |
download | gitea-ad513a20e939691828ba415c9a565e8ff3daa95f.tar.gz gitea-ad513a20e939691828ba415c9a565e8ff3daa95f.zip |
#2302 Replace time.Time with Unix Timestamp (int64)
Diffstat (limited to 'models/action.go')
-rw-r--r-- | models/action.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/models/action.go b/models/action.go index f83b9ad898..91d43bae99 100644 --- a/models/action.go +++ b/models/action.go @@ -84,13 +84,18 @@ type Action struct { RefName string IsPrivate bool `xorm:"NOT NULL DEFAULT false"` Content string `xorm:"TEXT"` - Created time.Time `xorm:"created"` + Created time.Time `xorm:"-"` + CreatedUnix int64 +} + +func (a *Action) BeforeInsert() { + a.CreatedUnix = time.Now().UTC().Unix() } func (a *Action) AfterSet(colName string, _ xorm.Cell) { switch colName { - case "created": - a.Created = regulateTimeZone(a.Created) + case "created_unix": + a.Created = time.Unix(a.CreatedUnix, 0).Local() } } |