Skip to content
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: improper conversion of iso8601 date to unix timestamp #48

Merged
merged 1 commit into from
Mar 15, 2022

Conversation

scinscinscin
Copy link
Contributor

What?

Fixes the cog_iso8601_to_unix_ms function to properly account for milliseconds in ISO8601 dates

Why?

Previously, the function was broken because the double second field was being cast to a uint_64 before being multiplied by 1000, thus the decimal was being rounded For example, 54.043 was being cast to 54 before being multiplied by 1000, thus the result was 54000 instead of 54043

How?

The solution was to add parenthesis so that the multiplication happens before the casting.

Testing?

I tested my changes by creating another bot in discord.js and comparing the timestamps there with the timestamps generated by concord.

Screenshots (optional)

Here's what the behavior looked like before I made these changes (notice that Concord's timestamps are rounded to the nearest thousands):
image
image

Here's what the behavior is like after I made the changes:
image

@lcsmuller lcsmuller merged commit fe93008 into Cogmasters:master Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants