diff --git a/models/action.go b/models/action.go index d39209c44..d4a07ced3 100644 --- a/models/action.go +++ b/models/action.go @@ -89,7 +89,7 @@ type Action struct { } func (a *Action) BeforeInsert() { - a.CreatedUnix = time.Now().UTC().Unix() + a.CreatedUnix = time.Now().Unix() } func (a *Action) AfterSet(colName string, _ xorm.Cell) { diff --git a/models/admin.go b/models/admin.go index c2db03daf..68731a243 100644 --- a/models/admin.go +++ b/models/admin.go @@ -35,7 +35,7 @@ type Notice struct { } func (n *Notice) BeforeInsert() { - n.CreatedUnix = time.Now().UTC().Unix() + n.CreatedUnix = time.Now().Unix() } func (n *Notice) AfterSet(colName string, _ xorm.Cell) { diff --git a/models/issue.go b/models/issue.go index 189b207df..74d535615 100644 --- a/models/issue.go +++ b/models/issue.go @@ -64,13 +64,13 @@ type Issue struct { } func (i *Issue) BeforeInsert() { - i.CreatedUnix = time.Now().UTC().Unix() + i.CreatedUnix = time.Now().Unix() i.UpdatedUnix = i.CreatedUnix } func (i *Issue) BeforeUpdate() { - i.UpdatedUnix = time.Now().UTC().Unix() - i.DeadlineUnix = i.Deadline.UTC().Unix() + i.UpdatedUnix = time.Now().Unix() + i.DeadlineUnix = i.Deadline.Unix() } func (issue *Issue) loadAttributes(e Engine) (err error) { @@ -1046,7 +1046,7 @@ type Milestone struct { } func (m *Milestone) BeforeInsert() { - m.DeadlineUnix = m.Deadline.UTC().Unix() + m.DeadlineUnix = m.Deadline.Unix() } func (m *Milestone) BeforeUpdate() { @@ -1056,8 +1056,8 @@ func (m *Milestone) BeforeUpdate() { m.Completeness = 0 } - m.DeadlineUnix = m.Deadline.UTC().Unix() - m.ClosedDateUnix = m.ClosedDate.UTC().Unix() + m.DeadlineUnix = m.Deadline.Unix() + m.ClosedDateUnix = m.ClosedDate.Unix() } func (m *Milestone) AfterSet(colName string, _ xorm.Cell) { @@ -1361,7 +1361,7 @@ type Attachment struct { } func (a *Attachment) BeforeInsert() { - a.CreatedUnix = time.Now().UTC().Unix() + a.CreatedUnix = time.Now().Unix() } func (a *Attachment) AfterSet(colName string, _ xorm.Cell) { diff --git a/models/issue_comment.go b/models/issue_comment.go index d1b7cb8d1..479da9206 100644 --- a/models/issue_comment.go +++ b/models/issue_comment.go @@ -69,7 +69,7 @@ type Comment struct { } func (c *Comment) BeforeInsert() { - c.CreatedUnix = time.Now().UTC().Unix() + c.CreatedUnix = time.Now().Unix() } func (c *Comment) AfterSet(colName string, _ xorm.Cell) { diff --git a/models/login.go b/models/login.go index dd90c5d86..84a5c2191 100644 --- a/models/login.go +++ b/models/login.go @@ -120,12 +120,12 @@ type LoginSource struct { } func (s *LoginSource) BeforeInsert() { - s.CreatedUnix = time.Now().UTC().Unix() + s.CreatedUnix = time.Now().Unix() s.UpdatedUnix = s.CreatedUnix } func (s *LoginSource) BeforeUpdate() { - s.UpdatedUnix = time.Now().UTC().Unix() + s.UpdatedUnix = time.Now().Unix() } // Cell2Int64 converts a xorm.Cell type to int64, diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 9f8388c37..6a1fb2f6d 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -646,17 +646,17 @@ func convertDateToUnix(x *xorm.Engine) (err error) { if bean.Deadline.IsZero() { continue } - fieldSQL += com.ToStr(bean.Deadline.UTC().Unix()) + fieldSQL += com.ToStr(bean.Deadline.Unix()) case "created": - fieldSQL += com.ToStr(bean.Created.UTC().Unix()) + fieldSQL += com.ToStr(bean.Created.Unix()) case "updated": - fieldSQL += com.ToStr(bean.Updated.UTC().Unix()) + fieldSQL += com.ToStr(bean.Updated.Unix()) case "closed_date": - fieldSQL += com.ToStr(bean.ClosedDate.UTC().Unix()) + fieldSQL += com.ToStr(bean.ClosedDate.Unix()) case "merged": - fieldSQL += com.ToStr(bean.Merged.UTC().Unix()) + fieldSQL += com.ToStr(bean.Merged.Unix()) case "next_update": - fieldSQL += com.ToStr(bean.NextUpdate.UTC().Unix()) + fieldSQL += com.ToStr(bean.NextUpdate.Unix()) } valSQLs = append(valSQLs, fieldSQL) diff --git a/models/pull.go b/models/pull.go index 6380bbbd2..38fd94571 100644 --- a/models/pull.go +++ b/models/pull.go @@ -65,7 +65,7 @@ type PullRequest struct { } func (pr *PullRequest) BeforeUpdate() { - pr.MergedUnix = pr.Merged.UTC().Unix() + pr.MergedUnix = pr.Merged.Unix() } // Note: don't try to get Pull because will end up recursive querying. diff --git a/models/release.go b/models/release.go index 2355ef309..274776b5c 100644 --- a/models/release.go +++ b/models/release.go @@ -39,7 +39,7 @@ type Release struct { } func (r *Release) BeforeInsert() { - r.CreatedUnix = time.Now().UTC().Unix() + r.CreatedUnix = time.Now().Unix() } func (r *Release) AfterSet(colName string, _ xorm.Cell) { diff --git a/models/repo.go b/models/repo.go index e46b54430..44e227550 100644 --- a/models/repo.go +++ b/models/repo.go @@ -184,12 +184,12 @@ type Repository struct { } func (repo *Repository) BeforeInsert() { - repo.CreatedUnix = time.Now().UTC().Unix() + repo.CreatedUnix = time.Now().Unix() repo.UpdatedUnix = repo.CreatedUnix } func (repo *Repository) BeforeUpdate() { - repo.UpdatedUnix = time.Now().UTC().Unix() + repo.UpdatedUnix = time.Now().Unix() } func (repo *Repository) AfterSet(colName string, _ xorm.Cell) { @@ -533,12 +533,12 @@ type Mirror struct { } func (m *Mirror) BeforeInsert() { - m.NextUpdateUnix = m.NextUpdate.UTC().Unix() + m.NextUpdateUnix = m.NextUpdate.Unix() } func (m *Mirror) BeforeUpdate() { - m.UpdatedUnix = time.Now().UTC().Unix() - m.NextUpdateUnix = m.NextUpdate.UTC().Unix() + m.UpdatedUnix = time.Now().Unix() + m.NextUpdateUnix = m.NextUpdate.Unix() } func (m *Mirror) AfterSet(colName string, _ xorm.Cell) { diff --git a/models/ssh_key.go b/models/ssh_key.go index b30217155..a279b4871 100644 --- a/models/ssh_key.go +++ b/models/ssh_key.go @@ -62,11 +62,11 @@ type PublicKey struct { } func (k *PublicKey) BeforeInsert() { - k.CreatedUnix = time.Now().UTC().Unix() + k.CreatedUnix = time.Now().Unix() } func (k *PublicKey) BeforeUpdate() { - k.UpdatedUnix = time.Now().UTC().Unix() + k.UpdatedUnix = time.Now().Unix() } func (k *PublicKey) AfterSet(colName string, _ xorm.Cell) { @@ -638,11 +638,11 @@ type DeployKey struct { } func (k *DeployKey) BeforeInsert() { - k.CreatedUnix = time.Now().UTC().Unix() + k.CreatedUnix = time.Now().Unix() } func (k *DeployKey) BeforeUpdate() { - k.UpdatedUnix = time.Now().UTC().Unix() + k.UpdatedUnix = time.Now().Unix() } func (k *DeployKey) AfterSet(colName string, _ xorm.Cell) { diff --git a/models/token.go b/models/token.go index d015d97aa..2c1f64ce0 100644 --- a/models/token.go +++ b/models/token.go @@ -29,11 +29,11 @@ type AccessToken struct { } func (t *AccessToken) BeforeInsert() { - t.CreatedUnix = time.Now().UTC().Unix() + t.CreatedUnix = time.Now().Unix() } func (t *AccessToken) BeforeUpdate() { - t.UpdatedUnix = time.Now().UTC().Unix() + t.UpdatedUnix = time.Now().Unix() } func (t *AccessToken) AfterSet(colName string, _ xorm.Cell) { diff --git a/models/user.go b/models/user.go index a7c877140..1050f2231 100644 --- a/models/user.go +++ b/models/user.go @@ -108,7 +108,7 @@ type User struct { } func (u *User) BeforeInsert() { - u.CreatedUnix = time.Now().UTC().Unix() + u.CreatedUnix = time.Now().Unix() u.UpdatedUnix = u.CreatedUnix } @@ -116,7 +116,7 @@ func (u *User) BeforeUpdate() { if u.MaxRepoCreation < -1 { u.MaxRepoCreation = -1 } - u.UpdatedUnix = time.Now().UTC().Unix() + u.UpdatedUnix = time.Now().Unix() } func (u *User) AfterSet(colName string, _ xorm.Cell) { diff --git a/models/webhook.go b/models/webhook.go index 02bea5cf0..79d60da3a 100644 --- a/models/webhook.go +++ b/models/webhook.go @@ -102,12 +102,12 @@ type Webhook struct { } func (w *Webhook) BeforeInsert() { - w.CreatedUnix = time.Now().UTC().Unix() + w.CreatedUnix = time.Now().Unix() w.UpdatedUnix = w.CreatedUnix } func (w *Webhook) BeforeUpdate() { - w.UpdatedUnix = time.Now().UTC().Unix() + w.UpdatedUnix = time.Now().Unix() } func (w *Webhook) AfterSet(colName string, _ xorm.Cell) { @@ -239,7 +239,7 @@ func deleteWebhook(bean *Webhook) (err error) { } // DeleteWebhookByRepoID deletes webhook of repository by given ID. -func DeleteWebhookByRepoID(repoID, id int64) (error) { +func DeleteWebhookByRepoID(repoID, id int64) error { return deleteWebhook(&Webhook{ ID: id, RepoID: repoID, @@ -247,7 +247,7 @@ func DeleteWebhookByRepoID(repoID, id int64) (error) { } // DeleteWebhookByOrgID deletes webhook of organization by given ID. -func DeleteWebhookByOrgID(orgID, id int64) (error) { +func DeleteWebhookByOrgID(orgID, id int64) error { return deleteWebhook(&Webhook{ ID: id, OrgID: orgID, @@ -573,7 +573,7 @@ func (t *HookTask) deliver() { } defer func() { - t.Delivered = time.Now().UTC().UnixNano() + t.Delivered = time.Now().UnixNano() if t.IsSucceed { log.Trace("Hook delivered: %s", t.UUID) } else {