Thread: timer problem

  1. #1
    Registered User
    Join Date
    Feb 2009
    Location
    India, Gujarat
    Posts
    22

    timer problem

    hi,

    in my program i m doing some timer related stuff, now my problem is that "how I can determine if the time of system is changed by any user manually or ntp client?"

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    That's pretty difficult unless you have second time-source. You could of course talk to a known good time-source (e.g. NTP server).

    What is the purpose of detecting this?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Feb 2009
    Location
    India, Gujarat
    Posts
    22
    i made one program which work like cron and it will take same format as cron ,
    i add one extra parameter of second, which is use to execute the job on occurrence of particular second now when may application is running and some change the time of system the i have to rearrange my list, my application is work on feature date, it will make the feature date of the job given to my application, now in case of time changing i have to rearrange the list so that's why.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677

    Post

    Ok, so perhaps you can do
    Code:
    for(;;)
    {
        sleep(10); 
        now = getcurrenttime();
        if (abs((now - old) - 10) > 1)
           ... Need rearrange list. 
        old = now;
    }
    It is not perfect, but should catch any large changes.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Feb 2009
    Location
    India, Gujarat
    Posts
    22
    ok
    i wll try it

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  2. design problem
    By hannibar in forum C Programming
    Replies: 6
    Last Post: 11-17-2005, 06:22 PM
  3. Replies: 5
    Last Post: 11-07-2005, 11:34 PM
  4. timer problem
    By robin171 in forum C Programming
    Replies: 2
    Last Post: 10-17-2005, 08:48 AM
  5. Help needed with external call, WinExec() and timer.
    By algorithm in forum Windows Programming
    Replies: 9
    Last Post: 11-07-2001, 09:35 AM