Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] [OT] Displaying time and starting from zero
- Date: Thu, 25 Mar 2010 10:21:14 +0900
- From: Darren Cook <darren@example.com>
- Subject: Re: [tlug] [OT] Displaying time and starting from zero
- References: <4BA9D37D.6030402@example.com> <4fac0ea81003240326h555714a7i5b3df39e23ecaef6@example.com> <4BAAB598.2050908@example.com>
- User-agent: Thunderbird 2.0.0.23 (X11/20090817)
> currTime = new Date(); > var elapsed = timeRemain.timeStamp - currTime.getTime(); > var seconds = Math.floor(elapsed/1000); > var minutes = Math.floor(seconds/60); > var hours = Math.floor(minutes/60); Math.floor() means divide and round down. I think you'll get what you want by changing the first one to round-up: var seconds = Math.ceil(elapsed/1000); I.e. 1ms has passed, so if the seconds rounds down it appears as if 1 whole seconds has passed. (But keep minutes and hours rounding down!) Darren -- Darren Cook, Software Researcher/Developer http://dcook.org/gobet/ (Shodan Go Bet - who will win?) http://dcook.org/work/ (About me and my work) http://dcook.org/blogs.html (My blogs and articles)
- Follow-Ups:
- Re: [tlug] [OT] Displaying time and starting from zero
- From: Dave M G
- References:
- [tlug] [OT] Displaying time and starting from zero
- From: Dave M G
- Re: [tlug] [OT] Displaying time and starting from zero
- From: Travis Cardwell
- Re: [tlug] [OT] Displaying time and starting from zero
- From: Dave M G
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] [OT] Displaying time and starting from zero
- Next by Date: Re: [tlug] can anyone help ..I need to repair my grub ...
- Previous by thread: Re: [tlug] [OT] Displaying time and starting from zero
- Next by thread: Re: [tlug] [OT] Displaying time and starting from zero
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links