You need to get the number of complete hours with int(ms/1000/60/60) put
that in a string, add ':'. Then work out how many milliseconds are left if
you take that many hours-worth of milliseconds away. Then do the same for
minutes, then what is left is the seconds (* 1000)
This is not a GWT problem (is it homework?), so if you need more info, email
me directly.

Ian

http://examples.roughian.com


2009/8/12 Charlie <[email protected]>

>
> but how do I set the time as "55:11:22"? right now I only managed to
> set the current date with Date() and then reduce a second every second
> with Timer() - but what you're saying that this won't be accurate?
> What I'm trying to do is when the user enters the application create a
> countdown clock which will update every second.
>
> On Aug 12, 6:26 pm, Ian Bambury <[email protected]> wrote:
> > Assuming the user sets a time to elapse and then presses 'Go', you need
> to
> > work out the time the countdown will expire, then set a recurring timer
> to
> > check the difference (you'll get this in milliseconds) then display the
> > difference in whatever format you choose.
> > You need to work to an end time rather than have a timer tick every
> second
> > and knock a second off the total. This is because the timer is not
> accurate
> > - it depends on when the computer decides to give the browser a
> time-slice,
> > and that depends on the computer loading and priorities and interrupts
> and
> > so on. Over longer periods you can get quite an error margin.
> >
> > You also need to set the Timer() you use to recur quite often, probably
> > about every 100ms or the display won't click over evenly. If you set it
> to
> > 1000ms for example, every so often you will skip the displaying of one of
> > the seconds.
> >
> > Ian
> >
> > http://examples.roughian.com
> >
> > 2009/8/12 Charlie <[email protected]>
> >
> >
> >
> >
> >
> > > Hey
> >
> > > I've been trying to create a custom countdown timer, and for some
> > > reason I can't find a way of createing a custom clock
> > > for example "55:22:11" meaning 55 hours 22 minutes 11 seconds and when
> > > the seconds are over it retracts from the minutes and the same for
> > > hours.- Hide quoted text -
> >
> > - Show quoted text -
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to