#2302 Replace time.Time with Unix Timestamp (int64)

This commit is contained in:
Unknwon 2016-03-09 19:53:30 -05:00
parent 0c9a616326
commit ad513a20e9
19 changed files with 516 additions and 125 deletions

View file

@ -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()
}
}