Find the answer to your Linux question:
Page 2 of 3 FirstFirst 1 2 3 LastLast
Results 11 to 20 of 22
lewmur:can you give sources about what you say ? 1.I've embedded board without clock chip and it works. Also, accessing MB RTC (RealTimeClock chip) is time consuming, so kernel keep ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #11
    RDU
    RDU is offline
    Just Joined!
    Join Date
    Aug 2010
    Posts
    89

    lewmur:can you give sources about what you say ?

    1.I've embedded board without clock chip and it works. Also, accessing MB RTC (RealTimeClock chip) is time consuming, so kernel keep time in memory.
    You can read and set the RTC chip with /sbin/hwclock cmd (see man hwclock)
    You can check what clock source is availlable for the kernel :
    $ cat /sys/devices/system/clocksource/clocksource0/available_clocksource
    And the one in use :
    $ cat /sys/devices/system/clocksource/clocksource0/current_clocksource
    Common one are TSC (counter into the processor), PIT, HPET, ... See the net for more detail, but all of then are derived from the MB xtal.
    It's possible to change the one in use by using a kernel parameter at boot.

    2.ntp don't update on occasional basis but it make the change smoothly to avoid any timing problem.

    3./etc/ntp/drift (see driftfile directive in ntp.conf)

    I'm maybe not an NTP engineer but I know what I'm saying.

  2. #12
    RDU
    RDU is offline
    Just Joined!
    Join Date
    Aug 2010
    Posts
    89
    Take a look here :
    The Clock Mini-HOWTO: How Linux Keeps Track of Time

    The first paragraph say :
    A Linux system actually has two clocks: One is the battery powered "Real Time Clock" (also known as the "RTC", "CMOS clock", or "Hardware clock") which keeps track of time when the system is turned off but is NOT used when the system is running. The other is the "system clock" (sometimes called the "kernel clock" or "software clock") which is a software counter based on the timer interrupt. It does not exist when the system is not running, so it has to be initialized from the RTC (or some other time source) at boot time

  3. #13
    Just Joined! charlie_arya's Avatar
    Join Date
    Sep 2009
    Posts
    39

    Smile

    Quote Originally Posted by lewmur View Post
    There is no such thing as a "drift file." Linux reads the BIOS clock for timing. NTP merely resets the BIOS clock to match whatever "standard" clock you have it set to read over the Internet, on an occasional basis.

    To put it simply, RDU doesn't know what he/she is talking about.
    Hey, Linux maintains its own clock and does not have to do anything from cmos clock. It reads the cmos clock at the time of bootup and then it maintains time on its own. NTP merely sync the kernel clock and does not have to do anything to do with cmos clock. There are system calls which we can use to write cmos clock to kernel clcok or kernel clock to cmos clock. This is the way we sync these two. See following system call:

    hwclock -s update kernel clock from cmos clock.
    hwclock -w update cmos clock from kernel clock.

    The drift file which kernel has is for NTP. I haven't seen any drift file which kernel maintains for its own.

    Correct me If I am wrong anywhere in my understanding of S/W and H/W clock and NTP/drift.

  4. $spacer_open
    $spacer_close
  5. #14
    RDU
    RDU is offline
    Just Joined!
    Join Date
    Aug 2010
    Posts
    89
    That's correct

  6. #15
    Just Joined! charlie_arya's Avatar
    Join Date
    Sep 2009
    Posts
    39
    Quote Originally Posted by RDU View Post
    That's correct
    I did following and what i see is :
    cat /sys/devices/system/clocksource/clocksource0/available_clocksource
    pit jiffies

    cat /sys/devices/system/clocksource/clocksource0/current_clocksource
    pit

    it seems that pit_interrupts are taking care of kernel clock instead of jiffies.And what i feel that if that is the case then the excess interrupts or number of lost interrupts may be the reason behind this but not sure how is does. This can only be when it read the total accumulated interrupt and then decide the time. Just a guess...not sure how it works. Any suggestions?

  7. #16
    RDU
    RDU is offline
    Just Joined!
    Join Date
    Aug 2010
    Posts
    89
    I'm not specialist in that but excess of interrupt is not possible unless XTAL frequency is too high. Lost of interrupt would depend of the load (an heavy loaded board compared to a board doing 'nothing' would be slower).
    Is it the case ? Are you too fast or too slow ?
    Anyway, as I said before, 8 second a day is 8 per 86400 is about 92 ppm wich is in the tolerance of a simple uncalibrated XTAL oscillator (usualy 100ppm). Did you have a way to mesure precicely the clock speed of your board (frequencymeter + schematic) ?

  8. #17
    RDU
    RDU is offline
    Just Joined!
    Join Date
    Aug 2010
    Posts
    89
    This article give you ppm value (and corresponding drift per day or per month) of several common time reference begining with XTAL (8s a day) to cesium atomic clock (8 nano-second a day).

    PPM Clock accuracy examples

  9. #18
    Just Joined! charlie_arya's Avatar
    Join Date
    Sep 2009
    Posts
    39
    Quote Originally Posted by RDU View Post
    This article give you ppm value (and corresponding drift per day or per month) of several common time reference begining with XTAL (8s a day) to cesium atomic clock (8 nano-second a day).

    PPM Clock accuracy examples
    I gave a watch on /proc/interrupt and see that the number of interrupts for at91_tick is not constant.
    watch cat /proc/interrupt
    updates at every 2 sec and i get interrupts ranging between 238-242.
    Though it is very less diversion but its accumulating and does this accumulation can give rise to drift. I am still investigating.

  10. #19
    RDU
    RDU is offline
    Just Joined!
    Join Date
    Aug 2010
    Posts
    89
    How do you do that ?
    If it's something like
    cat /proc/interrupts && sleep 2 && cat /proc/interrupts
    you're wrong because the speep itself is base on the tick and because 250 per second is 4 ms wich is less than the time the kernel need to start processess. It's NOT a real time OS.
    To make mesurement, you need metrology system.

  11. #20
    Just Joined! charlie_arya's Avatar
    Join Date
    Sep 2009
    Posts
    39
    Quote Originally Posted by RDU View Post
    How do you do that ?
    If it's something like
    cat /proc/interrupts && sleep 2 && cat /proc/interrupts
    you're wrong because the speep itself is base on the tick and because 250 per second is 4 ms wich is less than the time the kernel need to start processess. It's NOT a real time OS.
    To make mesurement, you need metrology system.

    I am not sure how exactly watch command is implemented.. but if we give watch command before any command it refresheds it at every 2 sec..

Page 2 of 3 FirstFirst 1 2 3 LastLast

Posting Permissions

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