DELL Networking SONiC How to set Date, Time, Clock, and Time zone manually

Summary: This article explains how to set Date, Time, Clock, and Time zone manually in Dell SONiC.

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Instructions

Points to Remember 

  • This procedure requires the user to have an admin role to access Linux Shell.
  • The best practice is to configure the clock using an NTP server in all devices in the network when an NTP server is available.

 

Steps

Verify RTC and NTP Status.
Disable the Real-Time Clock and Network Time Protocol if they are activated.
Configure Date & time.
How to Set time zone
 

Verify RTC and NTP Status.

Use the following command to verify RTC and NTP status.

Command Syntax
From Linux Shell

admin@DELLSONiC:~$ sudo timedatectl status

Sample Output

admin@DELLSONiC:~$ sudo timedatectl status
               Local time: Tue 2023-10-03 04:01:58 UTC
           Universal time: Tue 2023-10-03 04:01:58 UTC
                 RTC time: Tue 2023-10-03 04:01:59
                Time zone: UTC (UTC, +0000)
System clock synchronized: no
              NTP service: inactive
          RTC in local TZ: Yes
admin@sonic:~$ 


Or

Command Syntax
From the DELL Management framework CLI

admin@DELLSONiC:~$ sonic-cli
DELLSONiC# show clock

Sample Output

DELLSONiC# show clock 
Tue 03 Oct 2023 04:02:28 AM UTC

 

Disable the Real-Time Clock and Network Time Protocol if they are activated. 

RTC is recommended to remain off so that the real time clock uses UTC and not local to prevent time zone or daylight savings change issues. NTP is turned off to ensure that NTP is not synced when wanting to manually set time on the switch. 

Use the following command in the Linux shell to disable Real-time Clock and NTP. 

Command Syntax

admin@DELLSONiC:~$ sudo timedatectl set-local-rtc false
admin@DELLSONiC:~$ sudo timedatectl set-ntp false

Sample Output

Verify

admin@DELLSONiC:~$ sudo timedatectl status
               Local time: Tue 2023-10-03 04:01:58 UTC
           Universal time: Tue 2023-10-03 04:01:58 UTC
                 RTC time: Tue 2023-10-03 04:01:59
                Time zone: UTC (UTC, +0000)
System clock synchronized: no
              NTP service: inactive
          RTC in local TZ: No
admin@sonic:~$ 

 

Configure Date & time.

Command Syntax

admin@DELLSONiC:~$ sudo timedatectl set-time YYYY-MM-DD HH:MM:SS

YYYY-MM-DD is Year- Month-Day
HH:MM:SS   is Hour:Minute:Seconds

Sample Configuration
Consider that the DATE is set as 2023-12-30 and time 12:30:50.

admin@DELLSONiC:~$ sudo timedatectl set-time '2023-12-30 12:30:50'

Sample Output

Verify

admin@DELLSONiC:~$ sudo timedatectl status
               Local time: Sat 2023-12-30 07:31:52 EST
           Universal time: Sat 2023-12-30 12:31:52 UTC
                 RTC time: Sat 2023-12-30 12:31:53
                Time zone: Etc/UTC (UTC, +0000)
System clock synchronized: no
              NTP service: inactive
          RTC in local TZ: no
admin@DELLSONiC:~$ 

 

How to Set time zone

Command Syntax

admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure
DELLSONiC(config)# clock timezone <Time zone>

Hint: use ? to find out the available options

Sample Output (Output trimmed for Brevity)

ELLSONiC(config)# clock timezone ?
  Africa/             Africa timezones
  America/            America timezones
  Antarctica/         Antarctica timezones
  Arctic/             Arctic timezones
  Asia/               Asia timezones
  Atlantic/           Atlantic timezones
  Australia/          Australia timezones
  Brazil/             Brazil timezones
  Canada/             Canada timezones
  CET                 CET timezone
  Chile/              Chile timezones

Sample Configuration

admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure
DELLSONiC(config)# clock timezone America/New_York 

Sample Output

Verify

admin@DELLSONiC:~$ sudo timedatectl status
               Local time: Sat 2023-12-30 07:34:29 EST
           Universal time: Sat 2023-12-30 12:34:29 UTC
                 RTC time: Sat 2023-12-30 12:34:29
                Time zone: America/New_York (EST, -0500)
System clock synchronized: no
              NTP service: inactive
          RTC in local TZ: no
admin@DELLSONiC:~$ 

Affected Products

Enterprise SONiC Distribution, PowerSwitch S6000 ON, PowerSwitch E3200-ON Series, Dell EMC Networking N3200-ON, PowerSwitch S5212F-ON, PowerSwitch S5224F-ON, PowerSwitch S5232F-ON, PowerSwitch S5248F-ON, PowerSwitch S5296F-ON, PowerSwitch S6100-ON , PowerSwitch Z9100-ON, PowerSwitch Z9264F-ON, PowerSwitch Z9332F-ON ...
Article Properties
Article Number: 000218204
Article Type: How To
Last Modified: 14 Oct 2023
Version:  3
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.