Onion Omega2+ as NTP client ?



  • I want to set up a spare Omega2+ with OLED display as a dedicated NTP client network clock.

    I run a GPS-based Raspberry Pi as an NTP server and have set up my Omega2 devices to get the time from that. So far so good. However, I'm trying to find an NTP client using opkg and can't find one.. What do I need to use?

    Thanks in advance.



  • @peter-garner-0 there is a ntpd installed and running already as client. In the init scripts it is called sysntpd, because it is a part of the openwrt base system.

    The command line utility is named ntpd (technically it is part of busybox, like most command line tools are in openwrt).

    Ususally, you don't need to manually call it, as it is set up to run at system start automatically. It synchronizes the time from the openwrt/lede pool of ntp servers by default. You can see these using openwrt's UCI configuration tool:

    # show system's ntp settings
    uci show system.ntp
    

    You'll get something like:

    system.ntp=timeserver
    system.ntp.server='0.openwrt.pool.ntp.org' '1.openwrt.pool.ntp.org' '2.openwrt.pool.ntp.org' '3.openwrt.pool.ntp.org'
    system.ntp.enabled='1'
    system.ntp.enable_server='0'
    

    If you want to change the ntp servers, you can do that using UCI as well:

    # delete existing list of servers
    uci set system.ntp.server=
    # add one or more servers
    uci add_list system.ntp.server='my-ntp-server.org'
    uci add_list system.ntp.server='my-other-ntp-server.org'
    # commit the changes
    uci commit
    # have (sys)ntpd reload its own config
    /etc/init.d/sysntpd reload


  • I would also add that you need to ensure you have correctly configured your local timezone or ntp will mess up your time:

    uci set system.@system[0].timezone='UTC'
    uci commit system
    reload_config

    If you're outside the US as I am the timezone is a little more complex:

    uci set system.@system[0].timezone='AEST-10AEDT,M10.1.0,M4.1.0/3'
    uci set system.@system[0].zonename='Canberra, Melbourne, Sydney'



  • @luz said in Onion Omega2+ as NTP client ?:

    there is a ntpd installed and running already as client

    Ah, I see! That makes sense now. So all I really need to do is to write the time to the OLED at regular intervals - every minute is good enough - and ntpd will take care of fetching the time.

    Great! Thanks ...


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.