< Home

clock timezone

Function

The clock timezone command sets system time to your local time zone.

The undo clock timezone command restores system time to Coordinated Universal Time (UTC).

By default, the local time zone is the UTC time.

Format

clock timezone time-zone-name { add | minus } offset

undo clock timezone

Parameters

Parameter Description Value
time-zone-name Specifies the name of the time zone. The value is a string of 1 to 32 case-sensitive characters without spaces.
NOTE:
When double quotation marks are used around the string, spaces are allowed in the string.
add Indicates that the time of time-zone-name is equal to the UTC time plus the time offset. That is, the default UTC time plus offset is equal to the time of time-zone-name. -
minus Indicates that the time of time-zone-name is equal to the UTC time minus the time offset. That is, the default UTC time minus offset is equal to the time of time-zone-name. -
offset Specifies the difference between time-zone-name time and UTC time.
The format is HH:MM:SS.
  • HH specifies the hour.
    • If the local time is ahead of the UTC time, the value ranges from 0 to 14.
    • If the local time is behind UTC time, the value ranges from 0 to 12.
  • MM and SS specify minutes and seconds. Their values range from 0 to 59.
  • If HH is 14, MM and SS must be 0s.

Views

User view, System view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

The system clock is the time indicated by the system timestamp. Because the rules governing local time differ in different regions, the system clock can be configured to comply with the rules of any given region.

System clock = UTC + Time zone offset + DST offset

To ensure the normal communication between devices, set an accurate system clock. You can run the clock timezone and clock daylight-saving-time commands to set the time zone and DST offsets, respectively.

Configuration Impact

System time adjustment may affect the timing restart function. If you must adjust the system time after the timing restart function is enabled, take care of the impact of system time adjustment on the timing restart function:
  • If the system time is changed to less than 10 minutes later than the scheduled restart time, the system restarts immediately.
  • If the system time is changed to 10 minutes later than the scheduled restart time, the timing restart function is disabled.
  • If the system time is changed to 720 hours earlier than the scheduled restart time, the timing restart function is disabled.

Follow-up Procedure

After setting the time zone, use the display clock command to check the configuration. The time shown in messages such as logs and debugging information will be the local time in the time zone set, either standard or daylight saving time.

Precautions

  • Time settings use a 24-hour format. If you do not specify MM and SS, their values are set to 0. You must enter at least one digit number to specify HH. For example, if you enter 0, the time is 00:00:00.
  • After you run the clock timezone command in either the user or system view, the configuration files are both generated in the system view. You are advised to run this command in the system view.

Example

# In Beijing China, you can set the local time zone name to BJ.

If the default UTC time is London time and the local time in London is 00:00:00 on January 1, 2009, the method for obtaining the Beijing time is as follows: Beijing is in time zone UTC+8, and the time offset increases by 8. To obtain the expected BJ time zone, add offset 8 to the default UTC time zone.

<sysname> clock datetime 0:0:0 2009-01-01
<sysname> system-view
[sysname] clock timezone BJ add 08:00:00
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >