elm/core

truncate overflows when handling times in milliseconds

matsjoyce opened this issue · 1 comments

Same issue as #591 (tracked in #721). I am receiving a bunch of timestamps from an API as floating point seconds since the epoch. To process them I was doing:

Time.millisToPosix <| truncate <| t * 1000

which causes an overflow, giving times before 1970. Changing to:

Time.millisToPosix <| round <| t * 1000

fixed the issue, as would using ceiling. However, it would be nice if truncate could handle 64 bit floats without surprises.

Thanks for reporting this! To set expectations:

  • Issues are reviewed in batches, so it can take some time to get a response.
  • Ask questions a community forum. You will get an answer quicker that way!
  • If you experience something similar, open a new issue. We like duplicates.
    Finally, please be patient with the core team. They are trying their best with limited resources.