Thread: timer tick algorithms

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    2

    Post timer tick algorithms

    Can any body provide me with an algorithm which can convert timer ticks to absolute callender date and time. and from absolute date and time to timer ticks.

    the PCs use these algorithms. Solutions in any programming languages are wellcommed.

    Thankyou
    mohsin
    [email protected]

  2. #2
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    >Can any body provide me with an algorithm which can convert
    >timer ticks to absolute callender date and time. and from
    >absolute date and time to timer ticks.

    I don't think it is possible to get calender date and time just from ticks. But if I remember well, it is possible to get the number of ticks since some date. And if you know the number of ticks, then you also need to know the number of ticks per second on your machine. And from then on, you can calculate back to date and time.

    Assumption: start date is known / ticks per second is known

    nr_of_ticks = get nr of ticks since date;
    nr_of_seconds = nr_of_ticks / ticks per second;
    nr_of_minutes = nr_of_seconds / 60;
    etc.

    >Solutions in any programming languages are wellcommed.

    Algorithms are language independent.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SIGALRM and timer
    By nkhambal in forum C Programming
    Replies: 1
    Last Post: 06-30-2008, 12:23 AM
  2. tic tac toe crashes :(
    By stien in forum Game Programming
    Replies: 4
    Last Post: 05-13-2007, 06:25 PM
  3. Need help with a count down timer
    By GUIPenguin in forum C# Programming
    Replies: 0
    Last Post: 07-07-2006, 04:18 PM
  4. allegro timer
    By ichijoji in forum Game Programming
    Replies: 5
    Last Post: 12-07-2004, 07:11 PM