Fixin timestamp handling as Facebook sends back milliseconds timestamps (#12)
This commit is contained in:
parent
387e9a1083
commit
79275a89fd
@ -60,10 +60,10 @@ type PostBack struct {
|
|||||||
|
|
||||||
// Watermark is the RawWatermark timestamp rendered as a time.Time.
|
// Watermark is the RawWatermark timestamp rendered as a time.Time.
|
||||||
func (d Delivery) Watermark() time.Time {
|
func (d Delivery) Watermark() time.Time {
|
||||||
return time.Unix(d.RawWatermark, 0)
|
return time.Unix(d.RawWatermark/int64(time.Microsecond), 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Watermark is the RawWatermark timestamp rendered as a time.Time.
|
// Watermark is the RawWatermark timestamp rendered as a time.Time.
|
||||||
func (r Read) Watermark() time.Time {
|
func (r Read) Watermark() time.Time {
|
||||||
return time.Unix(r.RawWatermark, 0)
|
return time.Unix(r.RawWatermark/int64(time.Microsecond), 0)
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,7 @@ func (m *Messenger) dispatch(r Receive) {
|
|||||||
message := *info.Message
|
message := *info.Message
|
||||||
message.Sender = info.Sender
|
message.Sender = info.Sender
|
||||||
message.Recipient = info.Recipient
|
message.Recipient = info.Recipient
|
||||||
message.Time = time.Unix(info.Timestamp, 0)
|
message.Time = time.Unix(info.Timestamp/int64(time.Microsecond), 0)
|
||||||
f(message, resp)
|
f(message, resp)
|
||||||
}
|
}
|
||||||
case DeliveryAction:
|
case DeliveryAction:
|
||||||
@ -248,7 +248,7 @@ func (m *Messenger) dispatch(r Receive) {
|
|||||||
message := *info.PostBack
|
message := *info.PostBack
|
||||||
message.Sender = info.Sender
|
message.Sender = info.Sender
|
||||||
message.Recipient = info.Recipient
|
message.Recipient = info.Recipient
|
||||||
message.Time = time.Unix(info.Timestamp, 0)
|
message.Time = time.Unix(info.Timestamp/int64(time.Microsecond), 0)
|
||||||
f(message, resp)
|
f(message, resp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user