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.
Instructions
Points to Remember
|
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:~$ |