Results 1 to 2 of 2

Thread: Using the GetTickCount API to findout how many HOURs I have been in Windows???

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 1999
    Location
    Leeds, UK
    Posts
    287

    Post

    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

  2. #2
    Hyperactive Member badgers's Avatar
    Join Date
    Sep 1999
    Location
    Madison, WI USA
    Posts
    444

    Post

    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width