summaryrefslogtreecommitdiff
path: root/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-03-26 18:26:55 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-03-27 18:09:12 +0000
commitaf64e10400f8533a0c48ecdf5ab9b7fbf329e14e (patch)
tree59160e3841b440dd35189c724bbb4375a7be173b /vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go
parent26d7e3c7b85e28c4e42998c90fdcc14079f13eef (diff)
downloadpodman-af64e10400f8533a0c48ecdf5ab9b7fbf329e14e.tar.gz
podman-af64e10400f8533a0c48ecdf5ab9b7fbf329e14e.tar.bz2
podman-af64e10400f8533a0c48ecdf5ab9b7fbf329e14e.zip
Vendor in lots of kubernetes stuff to shrink image size
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #554 Approved by: mheon
Diffstat (limited to 'vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go')
-rw-r--r--vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go42
1 files changed, 19 insertions, 23 deletions
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go
index d55f446b0..7e5bc2d4e 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go
@@ -20,9 +20,6 @@ import (
"encoding/json"
"time"
- "k8s.io/apimachinery/pkg/openapi"
-
- "github.com/go-openapi/spec"
"github.com/google/gofuzz"
)
@@ -40,8 +37,8 @@ type MicroTime struct {
// DeepCopy returns a deep-copy of the MicroTime value. The underlying time.Time
// type is effectively immutable in the time API, so it is safe to
// copy-by-assign, despite the presence of (unexported) Pointer fields.
-func (t MicroTime) DeepCopy() MicroTime {
- return t
+func (t *MicroTime) DeepCopyInto(out *MicroTime) {
+ *out = *t
}
// String returns the representation of the time.
@@ -74,22 +71,22 @@ func (t *MicroTime) IsZero() bool {
}
// Before reports whether the time instant t is before u.
-func (t MicroTime) Before(u MicroTime) bool {
+func (t *MicroTime) Before(u *MicroTime) bool {
return t.Time.Before(u.Time)
}
// Equal reports whether the time instant t is equal to u.
-func (t MicroTime) Equal(u MicroTime) bool {
+func (t *MicroTime) Equal(u *MicroTime) bool {
return t.Time.Equal(u.Time)
}
// BeforeTime reports whether the time instant t is before second-lever precision u.
-func (t MicroTime) BeforeTime(u Time) bool {
+func (t *MicroTime) BeforeTime(u *Time) bool {
return t.Time.Before(u.Time)
}
// EqualTime reports whether the time instant t is equal to second-lever precision u.
-func (t MicroTime) EqualTime(u Time) bool {
+func (t *MicroTime) EqualTime(u *Time) bool {
return t.Time.Equal(u.Time)
}
@@ -149,16 +146,15 @@ func (t MicroTime) MarshalJSON() ([]byte, error) {
return json.Marshal(t.UTC().Format(RFC3339Micro))
}
-func (_ MicroTime) OpenAPIDefinition() openapi.OpenAPIDefinition {
- return openapi.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "date-time",
- },
- },
- }
-}
+// OpenAPISchemaType is used by the kube-openapi generator when constructing
+// the OpenAPI spec of this type.
+//
+// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators
+func (_ MicroTime) OpenAPISchemaType() []string { return []string{"string"} }
+
+// OpenAPISchemaFormat is used by the kube-openapi generator when constructing
+// the OpenAPI spec of this type.
+func (_ MicroTime) OpenAPISchemaFormat() string { return "date-time" }
// MarshalQueryParameter converts to a URL query parameter value
func (t MicroTime) MarshalQueryParameter() (string, error) {
@@ -175,10 +171,10 @@ func (t *MicroTime) Fuzz(c fuzz.Continue) {
if t == nil {
return
}
- // Allow for about 1000 years of randomness. Leave off nanoseconds
- // because JSON doesn't represent them so they can't round-trip
- // properly.
- t.Time = time.Unix(c.Rand.Int63n(1000*365*24*60*60*1000*1000), 0)
+ // Allow for about 1000 years of randomness. Accurate to a tenth of
+ // micro second. Leave off nanoseconds because JSON doesn't
+ // represent them so they can't round-trip properly.
+ t.Time = time.Unix(c.Rand.Int63n(1000*365*24*60*60), 1000*c.Rand.Int63n(1000000))
}
var _ fuzz.Interface = &MicroTime{}