Find the answer to your Linux question:
Results 1 to 2 of 2
Hi: I would like to monitor some time differences, in seconds (or miliseconds), from a linux program. I don't want this to be vulnerable to someone changing the system clock. ...
  1. #1
    Just Joined!
    Join Date
    Oct 2006
    Posts
    22

    Monitor time differences from userspace program

    Hi:

    I would like to monitor some time differences, in seconds (or miliseconds), from a linux program. I don't want this to be vulnerable to someone changing the system clock.

    What are my options?

    I realize that cat /proc/uptime and the uptime linux function provide a time in seconds(?). Is there an elegant way for a user space program to also access this information in binary form?

    Or is there a different timer that I can use from userspace? Jiffies are only available to the kernel?

    Thanks,
    --B

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    The man page for the times() function (notice the "s") shows that the function has as its return value (not the struct) the number of clock ticks since the system was booted. This is independent of the time of day.

    Hope this helps.
    --
    Bill

    Old age and treachery will overcome youth and skill.

Posting Permissions

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