1
0
mirror of synced 2024-11-22 12:56:06 +03:00

Fixin timestamp handling as Facebook sends back milliseconds timestamps (#12)

This commit is contained in:
Depado 2016-10-04 03:44:18 +02:00 committed by Harrison Shoebridge
parent 387e9a1083
commit 79275a89fd
2 changed files with 4 additions and 4 deletions

View File

@ -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)
} }

View File

@ -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)
} }
} }