Skip to content

Commit 0bc0c75

Browse files
v_huaqyeadevjoe
authored andcommitted
--bug=152701053 【子路径+时区】没有做时区方案 (merge request !2670)
Squash merge branch 'utc-time' into 'bk-bcs-multitenant' feat: fix time format utc TAPD: --bug=152701053
1 parent 168666c commit 0bc0c75

File tree

3 files changed

+5
-7
lines changed
  • bcs-services

3 files changed

+5
-7
lines changed

bcs-services/bcs-cluster-reporter/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ toolchain go1.23.2
77
replace (
88
github.com/prometheus/common => github.com/prometheus/common v0.42.0
99
// 引用 release-1.18-fix-go 分支,主要改动移除pilot/pkg/xds/fake.go 修复go1.21+编译问题
10-
istio.io/istio => github.com/silenceper/istio v0.0.0-20250527074856-9dba4a758551
10+
istio.io/istio => github.com/silenceper/istio v0.0.0-20250527074856-9dba4a758551
1111
k8s.io/api => k8s.io/api v0.27.3
1212
k8s.io/apimachinery => k8s.io/apimachinery v0.27.3
1313
k8s.io/cli-runtime => k8s.io/cli-runtime v0.27.3
@@ -48,6 +48,7 @@ require (
4848
k8s.io/api v0.31.2
4949
k8s.io/apiextensions-apiserver v0.29.0
5050
k8s.io/apimachinery v0.31.2
51+
k8s.io/apiserver v0.31.2
5152
k8s.io/cli-runtime v0.29.0
5253
k8s.io/client-go v11.0.0+incompatible
5354
k8s.io/klog v1.0.0
@@ -297,7 +298,6 @@ require (
297298
howett.net/plist v1.0.0 // indirect
298299
istio.io/client-go v1.18.6 // indirect
299300
istio.io/pkg v0.0.0-20231206023657-0332a732de8d // indirect
300-
k8s.io/apiserver v0.31.2 // indirect
301301
k8s.io/component-base v0.31.2 // indirect
302302
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
303303
oras.land/oras-go v1.2.4 // indirect

bcs-services/bcs-mesh-manager/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ require (
1919
github.com/grpc-ecosystem/grpc-gateway v1.16.0
2020
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1
2121
github.com/imdario/mergo v0.3.13
22+
github.com/pkg/errors v0.9.1
2223
github.com/prometheus/client_golang v1.19.0
2324
github.com/stretchr/testify v1.10.0
2425
github.com/urfave/cli/v2 v2.3.0
@@ -155,7 +156,6 @@ require (
155156
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
156157
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
157158
github.com/pjbgf/sha1cd v0.3.0 // indirect
158-
github.com/pkg/errors v0.9.1 // indirect
159159
github.com/pmezard/go-difflib v1.0.0 // indirect
160160
github.com/prometheus/client_model v0.5.0 // indirect
161161
github.com/prometheus/common v0.48.0 // indirect

bcs-services/bcs-user-manager/app/pkg/utils/time.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ type JSONTime struct {
2323
time.Time
2424
}
2525

26-
const timeLayout = "2006-01-02 15:04:05"
27-
2826
// MarshalJSON marshal json
2927
func (t *JSONTime) MarshalJSON() ([]byte, error) {
30-
return []byte(fmt.Sprintf("\"%s\"", t.Time.Format(timeLayout))), nil
28+
return []byte(fmt.Sprintf("\"%s\"", t.UTC().Format(time.RFC3339))), nil
3129
}
3230

3331
// UnmarshalJSON unmarshal json
@@ -38,6 +36,6 @@ func (t *JSONTime) UnmarshalJSON(b []byte) error {
3836
return nil
3937
}
4038
var err error
41-
t.Time, err = time.Parse(timeLayout, s)
39+
t.Time, err = time.Parse(time.RFC3339, s)
4240
return err
4341
}

0 commit comments

Comments
 (0)