Time

type alias Time = Float
to make it clearer when you are working with time values

now : Task x Time
get the Time at the moment when this task is run

every : Time -> (Time -> msg) -> Sub msg
subscribe to the current time

first you provide an interval describing how frequently you want updates
second, you give a tagger that turns a time into a message for your update function

so if you want to hear about the current time every second, you would say something like this:

type Msg = Tick Time | ...

subscriptions model =  every second Tick

Note: this function is not for animation! You need to use something based on requestAnimationFrame to get smooth animations. This is based on setInterval which is better for recurring tasks like “check on something every 30 seconds”.

millisecond : Time
second : Time
minute : Time
hour : Time

inMilliseconds : Time -> Float
inSeconds : Time -> Float
inMinutes : Time -> Float
inHours : Time -> Float