Embedded Linux
  • Cover
  • Summary
  • About This Training
    • Objectives
    • Skills
    • Prerequisites
    • Requirements
  • Once Upon A Time ...
  • Embedded Linux
  • Build Systems
    • Yocto Board Support Package
      • Yocto
      • Compilation
        • Make
        • Bitbake
        • Script
      • Building Blocks
      • SDK
      • Extra Packages
      • Kernel
        • Patch
        • Building
        • Headers
      • Modules
        • Cross Compilation
        • Native
      • Filesystem
      • Flashing
    • Distributions
      • CentOS
      • Google Brillo
      • Jubilinux
      • Kali
      • Ostro
      • Ubilinux
      • Debian
  • Boot Loaders
    • U-Boot
  • Initialization
    • Upgrade
    • Boot Up
    • Dual Boot
    • Root Directory
    • Display Message
    • Modules
    • Filesystem
    • Memory
    • Backup
    • Recovery
    • Reboot
    • Processes
  • User Space
    • Virtual Network Computing
    • Text Editors
    • Services
    • Logs
    • Package Management Systems
      • Open Package Management
      • Python Package Index
      • Nicely Package Make
      • Advanced Packaging Tool
      • Manual
      • Conda
    • Libraries
      • Mraa
      • Upm
      • OpenCv
      • Temboo
      • Libiio
    • Frameworks
      • Cylon JS
      • Johnny Five
      • ROS
      • Gobot
      • Pixhawk
      • Artoo
      • Bower
      • Zetta
      • Miscellaneous
  • Subsystems
    • X File Systems
    • Pin Muxing
    • Virtual File System
    • Memory
    • Input
    • General Purpose Input Output
    • Serial
    • Bluetooth
      • Advanced Audio Distribution Profile
        • Bluez
        • Gstreamer
        • Alsa
      • Human Interface Device Game Controller
      • Serial Port Protocol
      • Arduino
    • WiFi
    • Audio
    • Camera
    • Block
    • Universal Serial Bus
      • Human Interface Device Mini Keyboard
      • Python USB
    • Inter Integrated Circuit
    • Inter Process Communication
    • Peripheral Component Interconnect
    • Clock
    • Modems
    • Networking
    • Power
    • Thermal
    • Graphics
    • LED
    • LIDAR
    • Printer
    • Serial Peripheral Interface
  • Application Development
    • C
    • C++
    • Cross Compile
    • Containers
    • Python
    • NodeJS
    • Cloud9
    • Data
    • Drone Code
    • Speech
      • Python
    • Radio Frequency
    • Bots
    • Artificial Intelligence
      • WitAi
      • MycroftAi
    • Games
    • Vision
      • Bar Codes
      • Google Cloud Vision API
    • Messaging
    • Entertainment
    • Home Assistants
    • Dashboards
    • IRC
    • Location
    • Facial Recognition
    • Software Defined Radio
    • REST
    • Notes
    • Security
    • HAM Radio
    • Automotive
    • Digital Signage
    • Photography
  • Debug
  • Wrap-Up
    • Online Training
    • Challenge
    • Tbd
  • SandBox
Powered by GitBook
On this page
  • Kernel Integration
  • Kernel Display Message
  • Applications / Libraries
  • Setup
  • Programs
  1. Subsystems

Clock

PreviousPeripheral Component InterconnectNextModems

Last updated 7 years ago

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. References to "the clock" in the ntpd documentation refer to the system clock, not the RTC.

Kernel Integration

Kernel Display Message

    root@edison:~# dmesg | grep -i clock
    [    0.190320] SDIO bus = 1, name = bcm43xx_clk_vmmc, ref_clock = 26000000, addr =0x401
    [    0.208133] PTP clock support registered
    [    0.240814] hsu core clock 38 M
    [    0.242400] Switching to clocksource refined-jiffies
    [    1.534698] Switching to clocksource tsc
    [    2.076269] rtc_cmos rtc_cmos: setting system clock to 2000-01-01 00:00:09 UTC (946684809)

Applications / Libraries

Setup

Opkg

    root@edison:~# opkg install ntp
    Installing ntp (4.2.6p5-r6.0) on root.
    Downloading http://repo.opkg.net/edison/repo/core2-32/ntp_4.2.6p5-r6.0_core2-32.ipk.
    ntp: unsatisfied recommendation for iana-etc
    Installing ntp-tickadj (4.2.6p5-r6.0) on root.
    Downloading http://repo.opkg.net/edison/repo/core2-32/ntp-tickadj_4.2.6p5-r6.0_core2-32.ipk.
    Installing libbsd0 (0.7.0-r0) on root.
    Downloading http://repo.opkg.net/edison/repo/core2-32/libbsd0_0.7.0-r0_core2-32.ipk.
    Running useradd commands...
    NOTE: Performing useradd with [ --system --home-dir /var/lib/ntp                        --no-create-home                 y
    Configuring libbsd0.
    Configuring ntp-tickadj.
    Configuring ntp.
    ln -s '/lib/systemd/system/ntpd.service' '/etc/systemd/system/multi-user.target.wants/ntpd.service'
    root@edison:~# opkg install ntpdate
    root@edison:~# opkg install ntpdate
    Installing ntpdate (4.2.6p5-r6.0) on root.
    Downloading http://repo.opkg.net/edison/repo/core2-32/ntpdate_4.2.6p5-r6.0_core2-32.ipk.
    Configuring ntpdate.
    adding crontab
    ln -s '/lib/systemd/system/ntpdate.service' '/etc/systemd/system/multi-user.target.wants/ntpdate.service'

Programs

Network Time Protocol Client

root@edison:~# opkg install ntp
Installing ntp (4.2.6p5-r6.0) on root.
Downloading http://repo.opkg.net/edison/repo/core2-32/ntp_4.2.6p5-r6.0_core2-32.ipk.
ntp: unsatisfied recommendation for iana-etc
Installing ntp-tickadj (4.2.6p5-r6.0) on root.
Downloading http://repo.opkg.net/edison/repo/core2-32/ntp-tickadj_4.2.6p5-r6.0_core2-32.ipk.
Installing libbsd0 (0.7.0-r0) on root.
Downloading http://repo.opkg.net/edison/repo/core2-32/libbsd0_0.7.0-r0_core2-32.ipk.
Running useradd commands...
NOTE: Performing useradd with [ --system --home-dir /var/lib/ntp                        --no-create-hoy
Configuring libbsd0.
Configuring ntp-tickadj.
Configuring ntp.
ln -s '/lib/systemd/system/ntpd.service' '/etc/systemd/system/multi-user.target.wants/ntpd.service'
root@edison:~#
root@edison:~# opkg install ntpdate
Installing ntpdate (4.2.6p5-r6.0) on root.
Downloading http://repo.opkg.net/edison/repo/core2-32/ntpdate_4.2.6p5-r6.0_core2-32.ipk.
Configuring ntpdate.
adding crontab
ln -s '/lib/systemd/system/ntpdate.service' '/etc/systemd/system/multi-user.target.wants/ntpdate.servi'
root@edison:~# ntpdate -s time.nist.gov
root@edison:~# date
Mon Mar 21 20:14:51 UTC 2016
The Clock Mini-HOWTO