internal description of gettimeofday()

Submitted by numeriseriali
on December 15, 2004 - 7:12am

how does gettimeofday works ?

I mean ,it reads a register or read some file written by the o.s. with the time ?
the o.s. what register read of the processor ? (IA32)

[linux-2.4 running on the mod

olexiy
on
December 16, 2004 - 5:09am

[linux-2.4 running on the modern x86] - it reads the TSC (time stamp counter) the counter that increments each CPU clock. You can look at "arch/i386/kernel/time.c" file for details, see do_gettimeofday() and do_fast_gettimeoffset() functions. If "/proc/cpuinfo" shows "tsc" field in flags - your CPU has TSC support.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.