|
@@ -18,6 +18,29 @@ func (t ClockUTC) After(d time.Duration) <-chan time.Time {
|
|
|
return time.After(d)
|
|
|
}
|
|
|
|
|
|
+type ClockNY struct {
|
|
|
+ location *time.Location
|
|
|
+}
|
|
|
+
|
|
|
+func NewClockNY() (Clock, error) {
|
|
|
+ l, err := time.LoadLocation("America/New_York")
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ return ClockNY{
|
|
|
+ location: l,
|
|
|
+ }, nil
|
|
|
+}
|
|
|
+
|
|
|
+func (t ClockNY) Now() time.Time {
|
|
|
+ return time.Now().In(t.location)
|
|
|
+}
|
|
|
+
|
|
|
+func (t ClockNY) After(d time.Duration) <-chan time.Time {
|
|
|
+ return time.After(d)
|
|
|
+}
|
|
|
+
|
|
|
type StubClock struct {
|
|
|
Clock time.Time
|
|
|
}
|