Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Add fuzzing for time.Time #7

Merged
merged 1 commit into from
Aug 20, 2014
Merged

Add fuzzing for time.Time #7

merged 1 commit into from
Aug 20, 2014

Conversation

pmorie
Copy link
Contributor

@pmorie pmorie commented Aug 20, 2014

Per #6

var sec, nsec int64
c.Fuzz(&sec)
c.Fuzz(&nsec)
*t = time.Unix(sec, nsec)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that time.Time has a time zone. Might make sense to randomize that, too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lavalamp Agree it would be nice, but I think it will take a little more thought on how to do safely, since not all time zones may be loaded on all systems. See:

http://golang.org/pkg/time/#LoadLocation
http://golang.org/src/pkg/time/zoneinfo.go?s=7499:7548#L263

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. That is pretty ugly.

@lavalamp
Copy link
Contributor

LGTM - just one comment.

lavalamp added a commit that referenced this pull request Aug 20, 2014
Add fuzzing for time.Time
@lavalamp lavalamp merged commit cb58039 into google:master Aug 20, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants