8 Replies Latest reply on Mar 17, 2015 12:50 PM by mhahn

    Getting_setting_date and time on Edison

    eco_bach

      I have an active internet connection on the edsion, but when I enter 'date' I get a date and time that is over a week old. Why? Isn't the date and time always current?

       

       

      Mon Mar  9 20:21:19 UTC 2015

        • 1. Re: Getting_setting_date and time on Edison
          mhahn

          not sure -

          are you behind a proxy / firewall? do you use connman for network? (has a built-in lightweight ntp daemon)

          • 2. Re: Getting_setting_date and time on Edison
            eco_bach

            thanks. no firewall that I know of. Isn't it possible to simply set the date using

            $ date MMDDHHMMSS

             

            ??

            • 3. Re: Getting_setting_date and time on Edison
              mhahn

              sure - apart from the syntax would be slightly different (e.g. date(1): print/set system date/time - Linux man page).

              And preferably via timedatectl

               

              # timedatectl -h

              timedatectl [OPTIONS...] COMMAND ...

               

               

              Query or change system time and date settings.

               

               

                -h --help                Show this help message

                   --version             Show package version

                   --no-pager            Do not pipe output into a pager

                   --no-ask-password     Do not prompt for password

                -H --host=[USER@]HOST    Operate on remote host

                -M --machine=CONTAINER   Operate on local container

                   --adjust-system-clock Adjust system clock when changing local RTC mode

               

               

              Commands:

                status                   Show current time settings

                set-time TIME            Set system time

                set-timezone ZONE        Set system time zone

                list-timezones           Show known time zones

                set-local-rtc BOOL       Control whether RTC is in local time

                set-ntp BOOL             Control whether NTP is enabled

               

               

              However, the question why the date wouldn't be set automatically, right?

              • 4. Re: Getting_setting_date and time on Edison
                eco_bach

                ok came across another long thread on this topic

                Re: Setting time zone and synchronizing time with time server on Edison

                 

                so when I enter

                $systemctl status systemd-timesyncd

                I get

                 

                 

                root@tesla:~# systemctl status systemd-timesyncd

                systemd-timesyncd.service - Network Time Synchronization

                   Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled)

                   Active: active (running) since Mon 2015-03-09 20:07:57 UTC; 13min ago

                     Docs: man:systemd-timesyncd.service(8)

                Main PID: 156 (systemd-timesyn)

                   Status: "Idle."

                   CGroup: /system.slice/systemd-timesyncd.service

                           └─156 /lib/systemd/systemd-timesyncd

                 

                Jan 01 00:00:12 tesla systemd-timesyncd[156]: System clock time unset or jumped backwards, restoring fr... UTC

                Mar 09 20:07:57 tesla systemd[1]: Started Network Time Synchronization.

                Mar 09 20:08:02 tesla systemd-timesyncd[156]: Network configuration changed, trying to establish connection.

                Mar 09 20:08:03 tesla systemd-timesyncd[156]: Network configuration changed, trying to establish connection.

                Hint: Some lines were ellipsized, use -l to show in full.

                • 5. Re: Getting_setting_date and time on Edison
                  mhahn

                  hmmm, seems you have some issues:

                   

                  # systemctl status systemd-timesyncd

                  ● systemd-timesyncd.service - Network Time Synchronization

                     Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled)

                     Active: active (running) since Mon 2015-03-02 08:24:06 CET; 2 weeks 1 days ago

                       Docs: man:systemd-timesyncd.service(8)

                  Main PID: 152 (systemd-timesyn)

                     Status: "Using Time Server 216.239.36.15:123 (time3.google.com)."

                     CGroup: /system.slice/systemd-timesyncd.service

                             └─152 /lib/systemd/systemd-timesyncd

                   

                   

                  Jan 01 01:00:12 edison systemd-timesyncd[152]: System clock time unset or jumped backwards, restoring from recorded timestamp: Mon 2015-03-02 08:24:06 CET

                  Mar 02 08:24:06 edison systemd[1]: Started Network Time Synchronization.

                  Mar 02 08:24:10 edison systemd-timesyncd[152]: Network configuration changed, trying to establish connection.

                  Mar 02 08:24:10 edison systemd-timesyncd[152]: Network configuration changed, trying to establish connection.

                  Mar 02 08:24:10 edison systemd-timesyncd[152]: Network configuration changed, trying to establish connection.

                  Mar 02 08:24:11 edison systemd-timesyncd[152]: Network configuration changed, trying to establish connection.

                  Mar 02 08:24:11 edison systemd-timesyncd[152]: Network configuration changed, trying to establish connection.

                  Mar 17 17:02:35 edison systemd-timesyncd[152]: Network configuration changed, trying to establish connection.

                  Mar 17 17:03:05 edison systemd-timesyncd[152]: Using NTP server 216.239.36.15:123 (time3.google.com).

                  Mar 17 17:03:05 edison systemd-timesyncd[152]: interval/delta/delay/jitter/drift 64s/-0.025s/0.052s/0.000s/+0ppm

                  Mar 17 17:04:10 edison systemd-timesyncd[152]: interval/delta/delay/jitter/drift 128s/-0.006s/0.044s/0.002s/-23ppm

                  Mar 17 17:06:18 edison systemd-timesyncd[152]: interval/delta/delay/jitter/drift 256s/+0.014s/0.087s/0.009s/+4ppm

                  Mar 17 17:10:34 edison systemd-timesyncd[152]: interval/delta/delay/jitter/drift 512s/-0.005s/0.052s/0.009s/+0ppm

                  Mar 17 17:19:06 edison systemd-timesyncd[152]: interval/delta/delay/jitter/drift 1024s/-0.003s/0.045s/0.009s/-1ppm

                   

                   

                  Maybe try another time server?

                   

                  # cat /etc/systemd/timesyncd.conf

                  #  This file is part of systemd.

                  #

                  #  systemd is free software; you can redistribute it and/or modify it

                  #  under the terms of the GNU Lesser General Public License as published by

                  #  the Free Software Foundation; either version 2.1 of the License, or

                  #  (at your option) any later version.

                  #

                  # See timesyncd.conf(5) for details

                   

                   

                  [Time]

                  Servers=time1.google.com time2.google.com time3.google.com time4.google.com

                  • 6. Re: Getting_setting_date and time on Edison
                    eco_bach

                    Also if I enter

                    $timedatectl status

                     

                    I notice that NTP synchronized: no

                     

                    Local time: Mon 2015-03-09 20:31:47 UTC

                      Universal time: Mon 2015-03-09 20:31:47 UTC

                            RTC time: Sat 2000-01-01 00:24:02

                           Time zone: Universal (UTC, +0000)

                         NTP enabled: yes

                    NTP synchronized: no

                    RTC in local TZ: no

                          DST active: n/a

                    • 7. Re: Getting_setting_date and time on Edison
                      eco_bach

                      Ok narrowed the issue down to my edison configuration using connman to set a static IP.

                      If I revert back to default DHCP the time date is correct.

                       

                      Can't seem to reach any time servers after setting a static IP using

                       

                      $connmanctl config <service> --ipv4 manual <ip address> <netmask> <gateway>

                      • 8. Re: Getting_setting_date and time on Edison
                        mhahn

                        you probably would need to manually set nameservers, default gateway ...

                        In connmanctl there are various settings:

                        (timeservers for connman internal time sync)

                         

                        # connmanctl help

                        [...]

                        config          <service>             Set service configuration options

                          --nameservers     <dns1> [<dns2>] [<dns3>]

                          --timeservers     <ntp1> [<ntp2>] [...]

                        [...]

                           --ipv4            off|dhcp|manual <address> <netmask> <gateway>

                        [...]

                         

                        In particular you should be able to ping a named address like "ping google.com"

                         

                        if you install the connman-tests package you'd find some helpers which you might find of interest as well:

                         

                        # /usr/lib/connman/test/test-clock       

                        TimeUpdates = auto

                        Timezone = Europe/Paris

                        Timeservers = [ ]

                        TimezoneUpdates = auto

                        Time = 1426617841

                         

                        # /usr/lib/connman/test/set-nameservers

                        Usage: /usr/lib/connman/test/set-nameservers <service> [nameserver*]