Albert Cahalan wrote:
That's userspace, which works fine on a 2.4.xx kernel.
If userspace were to change, it wouldn't work OK for
a 2.4.xx kernel anymore. So consider that cast in stone.
"now" is the time() function. Using gettimeofday()
would only make sense if I decided to pay the cost
of asking for the time every time I look at a task.
While on the subject of time, is it possible to get a monotonic timer with 1ms or better resolution?
We need this for linux multimedia applications, and it is used to sync audio and video. Currently we use gettimeofday(). If a movie is playing, and the user goes and changes the time, or changes the timezone, we do not want that to effect the movie playing. I have not been able to find a monotonic 1ms accurate timer in the linux kernel, that is available to applications, and has little overhead. Some efficient ioctl or function call for uptime to 1ms accuracy would do perfectly.
If you want a timer, look into the posix clocks & timers which were added at 2.6.