Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upTime helper functions inSeconds, inMinutes etc. error #922
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
process-bot
Nov 24, 2017
Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!
Here is what to expect next, and if anyone wants to comment, keep these things in mind.
process-bot
commented
Nov 24, 2017
|
Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it! Here is what to expect next, and if anyone wants to comment, keep these things in mind. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
zwilias
Nov 24, 2017
Member
The intended usage, which isn't terribly well documented, is that you can do something like this:
twoMinutes : Time
twoMinutes = 2 * Time.minute
inSeconds twoMinutes --> 120The multiplication you propose as implementation for the inSeconds function is pretty much what you would use right now to convert a Float into Time.
Perhaps a second set of functions can be added like fromSeconds which turns a number of seconds into an equivalent Time representation, though.
|
The intended usage, which isn't terribly well documented, is that you can do something like this: twoMinutes : Time
twoMinutes = 2 * Time.minute
inSeconds twoMinutes --> 120The multiplication you propose as implementation for the Perhaps a second set of functions can be added like |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Skinney
Nov 24, 2017
Contributor
I think a lot of this confusion can be cleared up by specifying that Time represents milliseconds, and filling out examples for all the functions in the namespace.
|
I think a lot of this confusion can be cleared up by specifying that |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Skinney
Nov 24, 2017
Contributor
But the entire Time api is about to change in 0.19 anyway, right? So maybe this is a moot issue.
|
But the entire |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
mkwiatkowski
Nov 24, 2017
The API will change, but the documentation problem may remain. Current code on the dev branch is a bit confusing as the new Posix type seems to hold seconds (https://github.com/elm-lang/core/blob/dev/src/Time.elm#L62), but other functions treat it as milliseconds (https://github.com/elm-lang/core/blob/dev/src/Time.elm#L82).
mkwiatkowski
commented
Nov 24, 2017
|
The API will change, but the documentation problem may remain. Current code on the |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
evancz
Mar 7, 2018
Member
There is a PR about adding docs for these functions (#920) so I'll let that be the canonical one.
The documentation is gonna get updated for the new API. It's not the same, so the docs cannot stay the same.
|
There is a PR about adding docs for these functions (#920) so I'll let that be the canonical one. The documentation is gonna get updated for the new API. It's not the same, so the docs cannot stay the same. |
Saulzar commentedNov 24, 2017
Time is an alias for Float which specifies time as a unit of milliseconds as far as I can tell. However, the helper functions inSeconds
For example
isSeconds 2 = 0.002!! Where 2 seconds should be 2000 millisecondsInstead of divding by
secondit should be multiplied.