aboutsummaryrefslogtreecommitdiffstats
path: root/modules/timeutil/timestamp.go
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2022-08-25 18:05:21 +0200
committerGitHub <noreply@github.com>2022-08-25 12:05:21 -0400
commitdc0253b0637bbf367ad330612900e780c6b2b0e6 (patch)
tree85a51c2e9b355bef889e6fdae2e71b49fd645fbb /modules/timeutil/timestamp.go
parent5e232e86de6bb26038e0ebaec60368d54a327446 (diff)
downloadgitea-dc0253b0637bbf367ad330612900e780c6b2b0e6.tar.gz
gitea-dc0253b0637bbf367ad330612900e780c6b2b0e6.zip
Replace `ServeStream` with `ServeContent` (#20903)
* Replace ServeStream with ServeContent. * Update modules/timeutil/timestamp.go Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'modules/timeutil/timestamp.go')
-rw-r--r--modules/timeutil/timestamp.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/timeutil/timestamp.go b/modules/timeutil/timestamp.go
index 88008d1fad..40fcb8603f 100644
--- a/modules/timeutil/timestamp.go
+++ b/modules/timeutil/timestamp.go
@@ -54,6 +54,11 @@ func (ts TimeStamp) AsTime() (tm time.Time) {
return ts.AsTimeInLocation(setting.DefaultUILocation)
}
+// AsLocalTime convert timestamp as time.Time in local location
+func (ts TimeStamp) AsLocalTime() time.Time {
+ return time.Unix(int64(ts), 0)
+}
+
// AsTimeInLocation convert timestamp as time.Time in Local locale
func (ts TimeStamp) AsTimeInLocation(loc *time.Location) (tm time.Time) {
tm = time.Unix(int64(ts), 0).In(loc)