jonboulle / clockwork

a fake clock for golang
Apache License 2.0
631 stars 57 forks source link

Set NewFakeClock initial time #2

Closed dghubble closed 8 years ago

dghubble commented 8 years ago

Using NewFakeClock() to make a Clock at a specific point in time requires a custom implementation (since fakeClock is internal) or calling Advance while depending on the internal detail that the clock starts in 1900. Is this within the desired project scope?

I previously considered this package for some testing which depended on a specific timestamp for validations.

jonboulle commented 8 years ago

Certainly open to this, just hadn't wanted to clutter up the interfaces. Any suggestions for a name? NewFakeClockAt(time.Time) or something?

dghubble commented 8 years ago

NewFakeClockAt sounds great and it matches the signature I was using to create a Clock :+1:

jonboulle commented 8 years ago

Fixed in c30457ecaf841a445abbaf6a184400abb4741bb8