-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix FBA timestamps that sometimes are in seconds instead of milliseconds #665
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #665 +/- ##
==========================================
+ Coverage 74.23% 74.24% +0.01%
==========================================
Files 97 97
Lines 13120 13127 +7
==========================================
+ Hits 9739 9746 +7
Misses 2692 2692
Partials 689 689 ☔ View full report in Codecov by Sentry. |
handlers/meta/handlers.go
Outdated
date := time.Unix(0, msg.Timestamp*1000000).UTC() | ||
var date time.Time | ||
|
||
if len(strconv.FormatInt(msg.Timestamp, 10)) > 12 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a little odd to convert an int to a string to do a length check when you could do...
if msg.Timestamp > 1_000_000_000_000
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found the right number to use is 100_000_000_000 that we cannot consider as milliseconds
after experimenting with https://www.epochconverter.com/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arg I didn't see you'd changed this again when I hit merge... what's wrong with 1_000_000_000_000
? That's never going to be a timestamp in seconds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
100_000_000_000 is the first that is matched as milliseconds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
99_999_999_999 should us seconds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that would be the year 5138 in seconds...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well I hear the UNIX timestamp will be broken around 2038, I guess the current achieve that for now
however the correct number to use that should always be detected as seconds is 100_000_000_000
94b8095
to
e13b8c5
Compare
e13b8c5
to
2041140
Compare
No description provided.