You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2019/12/12 01:30:27 UTC
[skywalking-cli] branch master updated: Change the default TZ to
the local TZ (#20)
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-cli.git
The following commit(s) were added to refs/heads/master by this push:
new e71c4a9 Change the default TZ to the local TZ (#20)
e71c4a9 is described below
commit e71c4a91399419d0307741c0041d2a72daee4ab3
Author: innerpeacez <in...@gmail.com>
AuthorDate: Thu Dec 12 09:30:22 2019 +0800
Change the default TZ to the local TZ (#20)
---
commands/interceptor/duration.go | 2 +-
commands/interceptor/duration_test.go | 9 +++++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/commands/interceptor/duration.go b/commands/interceptor/duration.go
index f17c2d9..186c3fe 100644
--- a/commands/interceptor/duration.go
+++ b/commands/interceptor/duration.go
@@ -69,7 +69,7 @@ func DurationInterceptor(ctx *cli.Context) error {
func ParseDuration(start, end string) (startTime, endTime time.Time, step schema.Step) {
logger.Log.Debugln("Start time:", start, "end time:", end)
- now := time.Now().UTC()
+ now := time.Now()
// both are absent
if start == "" && end == "" {
diff --git a/commands/interceptor/duration_test.go b/commands/interceptor/duration_test.go
index 64064d1..e8720ae 100644
--- a/commands/interceptor/duration_test.go
+++ b/commands/interceptor/duration_test.go
@@ -26,8 +26,7 @@ import (
)
func TestParseDuration(t *testing.T) {
- now := time.Now().UTC()
-
+ now := time.Now()
type args struct {
start string
end string
@@ -84,14 +83,16 @@ func TestParseDuration(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
gotStartTime, gotEndTime, gotStep := ParseDuration(tt.args.start, tt.args.end)
- if !reflect.DeepEqual(gotStartTime.Truncate(time.Minute), tt.wantedStartTime.Truncate(time.Minute)) {
+ current := gotStartTime.Truncate(time.Minute).Format(timeFormat)
+ spec := tt.wantedStartTime.Truncate(time.Minute).Format(timeFormat)
+ if !reflect.DeepEqual(current, spec) {
t.Errorf(
"ParseDuration() got start time = %v, wanted start time %v",
gotStartTime.Truncate(time.Minute),
tt.wantedStartTime.Truncate(time.Minute),
)
}
- if !reflect.DeepEqual(gotEndTime.Truncate(time.Minute), tt.wantedEndTime.Truncate(time.Minute)) {
+ if !reflect.DeepEqual(current, spec) {
t.Errorf(
"ParseDuration() got end time = %v, wanted end time %v",
gotEndTime.Truncate(time.Minute),