Friday, September 14, 2012

SYSTEM CLOCKS



CLOCK_REALTIME : it gives the access to the real time clock (RTC) , i.e. the one that stores the current date and time.

     A key difference between an RTC and the system clock is that RTCs run even
     when the system is in a low power state (cpu Idle), and the system  clock can't. 
     Until it is initialized, the system clock can only report time since system boot, not 
     since the POSIX Epoch.  So at boot time, and after resuming from a system low 
     power state, the system clock will often be set to the current wall clock time using 
     an RTC.



CLOCK_MONOTONIC : it gives the access to a clock ( cpu ticks ) that never goes back in time .It takes the CPU Hz.

 It goes off when there will be no Hz ( cpu Idle state) . So when again CPU gets up ,
 it adds the sleeping time using another components input timerkeeping timer,
 basically a rough time. So it should be used in the usecase wherever we need delta 
 of time.Irrespective of cpu state during playback , whenever we do clock_gettime ,this
 clock will be there.
Basically these are clock_ids which provides clock source when we use clock_gettime()

otherwise to get the phone time , we can use gettimeofday() , this will change whenever there
will be change in wall time.

No comments:

Post a Comment