You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by lu...@apache.org on 2022/01/29 02:42:31 UTC
[skywalking-banyandb] branch fix-timezone-issue created (now a07fa65)
This is an automated email from the ASF dual-hosted git repository.
lujiajing pushed a change to branch fix-timezone-issue
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git.
at a07fa65 fix timezone issue
This branch includes the following new commits:
new a07fa65 fix timezone issue
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[skywalking-banyandb] 01/01: fix timezone issue
Posted by lu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
lujiajing pushed a commit to branch fix-timezone-issue
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git
commit a07fa65c37ee8efcd4dada465f511a482a7a3883
Author: Megrez Lu <lu...@gmail.com>
AuthorDate: Sat Jan 29 10:41:06 2022 +0800
fix timezone issue
---
banyand/tsdb/segment.go | 4 ++--
banyand/tsdb/shard.go | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/banyand/tsdb/segment.go b/banyand/tsdb/segment.go
index 580536c..60897d2 100644
--- a/banyand/tsdb/segment.go
+++ b/banyand/tsdb/segment.go
@@ -192,10 +192,10 @@ func (bc *blockController) startTime(suffix string) (time.Time, error) {
switch bc.blockSize.Unit {
case HOUR:
return time.Date(startTime.Year(), startTime.Month(),
- startTime.Day(), t.Hour(), 0, 0, 0, time.UTC), nil
+ startTime.Day(), t.Hour(), 0, 0, 0, startTime.Location()), nil
case DAY:
return time.Date(startTime.Year(), startTime.Month(),
- t.Day(), t.Hour(), 0, 0, 0, time.UTC), nil
+ t.Day(), t.Hour(), 0, 0, 0, startTime.Location()), nil
case MILLISECOND:
return time.Parse(millisecondFormat, suffix)
}
diff --git a/banyand/tsdb/shard.go b/banyand/tsdb/shard.go
index c65614d..c0e65c7 100644
--- a/banyand/tsdb/shard.go
+++ b/banyand/tsdb/shard.go
@@ -237,11 +237,11 @@ func (sc *segmentController) Format(tm time.Time) string {
func (sc *segmentController) Parse(value string) (time.Time, error) {
switch sc.segmentSize.Unit {
case HOUR:
- return time.Parse(segHourFormat, value)
+ return time.ParseInLocation(segHourFormat, value, time.Local)
case DAY:
- return time.Parse(segDayFormat, value)
+ return time.ParseInLocation(segDayFormat, value, time.Local)
case MILLISECOND:
- return time.Parse(millisecondFormat, value)
+ return time.ParseInLocation(millisecondFormat, value, time.Local)
}
panic("invalid interval unit")
}