Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
152f0a15
Unverified
Commit
152f0a15
authored
Mar 26, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Mar 26, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #75693 from smarterclayton/speed_up_time_json
Reduce allocations in metav1.Time JSON serialization
parents
81d37386
b405cdf8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
time.go
staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/time.go
+7
-3
No files found.
staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/time.go
View file @
152f0a15
...
@@ -20,7 +20,7 @@ import (
...
@@ -20,7 +20,7 @@ import (
"encoding/json"
"encoding/json"
"time"
"time"
"github.com/google/gofuzz"
fuzz
"github.com/google/gofuzz"
)
)
// Time is a wrapper around time.Time which supports correct
// Time is a wrapper around time.Time which supports correct
...
@@ -147,8 +147,12 @@ func (t Time) MarshalJSON() ([]byte, error) {
...
@@ -147,8 +147,12 @@ func (t Time) MarshalJSON() ([]byte, error) {
// Encode unset/nil objects as JSON's "null".
// Encode unset/nil objects as JSON's "null".
return
[]
byte
(
"null"
),
nil
return
[]
byte
(
"null"
),
nil
}
}
buf
:=
make
([]
byte
,
0
,
len
(
time
.
RFC3339
)
+
2
)
return
json
.
Marshal
(
t
.
UTC
()
.
Format
(
time
.
RFC3339
))
buf
=
append
(
buf
,
'"'
)
// time cannot contain non escapable JSON characters
buf
=
t
.
UTC
()
.
AppendFormat
(
buf
,
time
.
RFC3339
)
buf
=
append
(
buf
,
'"'
)
return
buf
,
nil
}
}
// OpenAPISchemaType is used by the kube-openapi generator when constructing
// OpenAPISchemaType is used by the kube-openapi generator when constructing
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment