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][tlug] [OT] Displaying time and starting from zero
- Date: Wed, 24 Mar 2010 17:55:25 +0900
- From: Dave M G <dave@example.com>
- Subject: [tlug] [OT] Displaying time and starting from zero
- User-agent: Thunderbird 2.0.0.24 (X11/20100317)
TLUG, I suppose this is kind of a general programming question in a way, although in this instance I'm specifically working with JavaScript. I have a timer thing that sets a countdown for an hour. It all works fine, but when the display shows the timer, it shows it as starting from 0:59. I think this is because I set the countdown timer in milliseconds at 3600000 milliseconds, but the timer starts at zero, not one. This means the actual time being set is 59 minutes and 59.999 seconds. Maybe. I think. Not sure, really. Is time usually counted from zero? I thought the quick and easy solution to get the display to show 1:00 instead of 0:59 would be to add one millisecond to my timer: 3600001. That didn't do it. So I added a whole second: 3601000. That worked, but then it felt like I was just adding arbitrary amounts of time. Which got me wondering if there was a better way to do this. Like setting some kind of math rounding function or string offset so you can get an hour countdown that displays as being from 1 hour and not 59 minutes and 59 seconds. By the way, I'm bad at math, so I might have messed up a number. I usually have to dial things in when I deal with numbers because I mess things up a lot. So if I've thrown the example numbers a bit, I hope my explanation still makes sense. -- Dave M G
- Follow-Ups:
- Re: [tlug] [OT] Displaying time and starting from zero
- From: Godwin Stewart
- Re: [tlug] [OT] Displaying time and starting from zero
- From: Travis Cardwell
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] YLUG 102nd Kernel Reading meeting
- Next by Date: Re: [tlug] [OT] Displaying time and starting from zero
- Previous by thread: [tlug] speech recognition?
- Next by thread: Re: [tlug] [OT] Displaying time and starting from zero
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links