From dc0253b0637bbf367ad330612900e780c6b2b0e6 Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Thu, 25 Aug 2022 18:05:21 +0200 Subject: Replace `ServeStream` with `ServeContent` (#20903) * Replace ServeStream with ServeContent. * Update modules/timeutil/timestamp.go Co-authored-by: delvh Co-authored-by: delvh Co-authored-by: Lunny Xiao Co-authored-by: techknowlogick --- modules/timeutil/timestamp.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'modules/timeutil/timestamp.go') 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) -- cgit v1.2.3