From 151c8af8fdf69310f762ce18335a497f44095d97 Mon Sep 17 00:00:00 2001 From: Cao Shufeng Date: Tue, 26 Sep 2017 19:06:46 +0800 Subject: [PATCH] fix fuzz of micro time --- .../k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go b/staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go index dbe206704f..a09d79571c 100644 --- a/staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go +++ b/staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go @@ -175,10 +175,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{}