diff --git a/date.go b/date.go index e75bdaa..49e7c9e 100644 --- a/date.go +++ b/date.go @@ -208,18 +208,6 @@ func (d date) IsNASDAQHoliday(t time.Time) bool { return d.IsNYSEHoliday(t) } -// Eastern returns the eastern timezone. -func (d date) Eastern() *time.Location { - if _eastern == nil { - _easternLock.Lock() - defer _easternLock.Unlock() - if _eastern == nil { - _eastern, _ = time.LoadLocation("America/New_York") - } - } - return _eastern -} - // Time returns a new time.Time for the given clock components. func (d date) Time(hour, min, sec, nsec int, loc *time.Location) time.Time { return time.Date(0, 0, 0, hour, min, sec, nsec, loc) diff --git a/date_posix.go b/date_posix.go new file mode 100644 index 0000000..2ab23fe --- /dev/null +++ b/date_posix.go @@ -0,0 +1,17 @@ +// +build !windows + +package chart + +import "time" + +// Eastern returns the eastern timezone. +func (d date) Eastern() *time.Location { + if _eastern == nil { + _easternLock.Lock() + defer _easternLock.Unlock() + if _eastern == nil { + _eastern, _ = time.LoadLocation("America/New_York") + } + } + return _eastern +} diff --git a/date_windows.go b/date_windows.go new file mode 100644 index 0000000..7660a98 --- /dev/null +++ b/date_windows.go @@ -0,0 +1,17 @@ +// +build windows + +package chart + +import "time" + +// Eastern returns the eastern timezone. +func (d date) Eastern() *time.Location { + if _eastern == nil { + _easternLock.Lock() + defer _easternLock.Unlock() + if _eastern == nil { + _eastern, _ = time.LoadLocation("Eastern Standard Time") + } + } + return _eastern +}