forked from Elara6331/infinitime
Add the ability to set a custom time in weather timeline headers
This commit is contained in:
parent
f2640203e9
commit
f5546ca32e
@ -81,13 +81,12 @@ type TimelineHeader struct {
|
||||
|
||||
// NewHeader creates and populates a new timeline header
|
||||
// and returns it
|
||||
func NewHeader(evtType EventType, expires time.Duration) TimelineHeader {
|
||||
now := time.Now()
|
||||
_, offset := now.Zone()
|
||||
now = now.Add(time.Duration(offset) * time.Second)
|
||||
func NewHeader(t time.Time, evtType EventType, expires time.Duration) TimelineHeader {
|
||||
_, offset := t.Zone()
|
||||
t = t.Add(time.Duration(offset) * time.Second)
|
||||
|
||||
return TimelineHeader{
|
||||
Timestamp: uint64(now.Unix()),
|
||||
Timestamp: uint64(t.Unix()),
|
||||
Expires: uint32(expires.Seconds()),
|
||||
EventType: evtType,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user