From 6c2536b89c30ef1c99752abd50fdb3b5d2cd0691 Mon Sep 17 00:00:00 2001
From: Unknwon <u@gogs.io>
Date: Thu, 20 Aug 2015 00:32:18 +0800
Subject: [PATCH] fix timezone

---
 models/action.go     | 3 ++-
 models/issue.go      | 6 ++++--
 modules/base/tool.go | 1 -
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/models/action.go b/models/action.go
index 0e336c372b..2c08eebbd9 100644
--- a/models/action.go
+++ b/models/action.go
@@ -82,7 +82,8 @@ type Action struct {
 func (a *Action) AfterSet(colName string, _ xorm.Cell) {
 	switch colName {
 	case "created":
-		a.Created = a.Created.UTC()
+		now := time.Now()
+		a.Created = a.Created.Add(now.Sub(now.UTC()))
 	}
 }
 
diff --git a/models/issue.go b/models/issue.go
index 75345217c4..5e5c79c2e5 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -93,7 +93,8 @@ func (i *Issue) AfterSet(colName string, _ xorm.Cell) {
 			log.Error(3, "GetUserByID[%d]: %v", i.ID, err)
 		}
 	case "created":
-		i.Created = i.Created.UTC()
+		now := time.Now()
+		i.Created = i.Created.Add(now.Sub(now.UTC()))
 	}
 }
 
@@ -1359,7 +1360,8 @@ func (c *Comment) AfterSet(colName string, _ xorm.Cell) {
 			}
 		}
 	case "created":
-		fmt.Println(1, c.Created)
+		now := time.Now()
+		c.Created = c.Created.Add(now.Sub(now.UTC()))
 	}
 }
 
diff --git a/modules/base/tool.go b/modules/base/tool.go
index abf12791d3..16759f21f6 100644
--- a/modules/base/tool.go
+++ b/modules/base/tool.go
@@ -273,7 +273,6 @@ func TimeSincePro(then time.Time) string {
 
 func timeSince(then time.Time, lang string) string {
 	now := time.Now()
-	fmt.Println(2, now)
 
 	lbl := i18n.Tr(lang, "tool.ago")
 	diff := now.Unix() - then.Unix()