PDA

Click to See Complete Forum and Search --> : Using the GetTickCount API to findout how many HOURs I have been in Windows???


rino_2
Dec 30th, 1999, 02:28 AM
I have a maths question just for you. I made a program that works out how long you have been in windows. GetTickCount = the time you have been in windows in MILLISECONDS. So I made my program work out how long you have been in windows in MINUTES. The way I did this is as follows:

There are 1 thousand milliseconds in a second and 60 seconds in a minute so this was the command:

GetTickCount / 60000 (that works out how many minutes you have been in windows)

Now, I wanted to update my program to tell you how long in HOURS you have been in windows. I made a few calculations and this was the command that I came up with.

GetTickCount / 3600000

This was going great until a few minutes before an hour and it changed. Is there somebody out there smart enough to work out the correct calculation to work out how long you have been in windows in HOURS?

Thanks

badgers
Dec 30th, 1999, 02:36 AM
how much can the gettickcount variable hold.
If your computer is on for an 8 hour day the number of milliseconds will be
28800000(28.8 million)
that is a big number. Maybe your variable could not hold the number or somehow the math function is truncating your result.
you are correct that there are 60 thousand milliseconds in a minute and there are 3.6 million milliseconds in an hour

------------------
I am so skeptacle, I can hardly believe it!