Add a field called startTime : Time to your model, which tracks when the timer was started. Taking the difference between the current time and startTime gives you the first quantity you wanted. To get the second quantity, write (t % 60) // 1. The (//) operation rounds it down, and the (%) operation does the rest.
On Saturday, June 18, 2016 at 7:07:10 PM UTC-4, Juan Martin Buireo wrote: > > Hi, I am currently developing an elm-game in version 0.17 > > I read the guide and the example about the time ( > http://guide.elm-lang.org/architecture/effects/time.html). I understood > the example but now I need to use that to make something similar. > > What i need to do is a chronometer. The chronometer starts in zero and as > time passes, seconds and minutes increase. This will be printed as a > string. But what I notice about the example of the Time is that no matter > that I set the time initally to zero, when it runs it gives me the actual > time. Another problem that I have is that when i do the > > toString (inMinutes time) this prints me something like 24438186.788516667. > I want the minutes as [0, 59]. > > Thanks > -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
