Re: knowing-current-time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stauros Passas (stabat@xxxxxxxxxxxxxxxxxxx) wrote:
> On Wed, 10 Aug 2005, Deepak Joshi wrote:
> 
> >Hi all,
> >
> >I read that in order to get the current time by using
> >do_gettimeofday( struct timeval *tv) function we need
> >to disable the inturrepts because we can't access both
> >fields of timeval struct tv_sec and tv_usec. Why is it
> >so ?
> Timing on linux kernel are base on Timer interrupts,that are
> generated by system's timing hardware at regular intervlas,
> according to the value of HZ. Every time a timer interrupt occurs,
> jiffies incremented. I suppose that fields of timeval struct are
> computed through jiffies, so it isn't safe to read them without
> first disabling interrupts.
 
It is a little more difficult than incremented jiffies in timer
interrupt ;)

Some corrections are applied.
 - http://lxr.linux.no/source/arch/i386/kernel/time.c
 - http://lxr.linux.no/source/kernel/timer.c#L867

Have a nice day,
 
				- Christophe (clucas@xxxxxxxxxxxxx)

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux