< Home

Setting the System Time Using the CLI

This section describes how to configure the system time on the CLI.

Manually Setting the Time

The administrator can manually set the system time of the device.

UTC indicates the Universal Time Coordinated.

  1. Set the current date and time.

    clock datetime  HH:MM:SS YYYY-MM-DD

  2. Set the time zone.

    clock timezone time-zone-name { add | minus } offset
    • If add is configured, the current time is the UTC time plus the time offset. That is, the default UTC time plus offset is equal to the time of time-zone-name.

    • If minus is configured, the current time is the UTC time minus the time offset. That is, the default UTC time minus offset is equal to the time of time-zone-name.

  3. Optional: Set the daylight saving time.

    clock daylight-saving-time time-zone-name one-year start-time start-date end-time end-date offset

    or

    clock daylight-saving-time time-zone-name repeating start-time { { first | second | third | fourth | last } weekday month | start-date } end-time { { first | second | third | fourth | last } weekday month | end-date } offset [ start-year [ end-year ] ]

    During the configuration of the daylight saving time, you can configure the start time and end time in one of the following modes: date+date, week+week, date+week, and week+date. For details, see clock daylight-saving-time.

    When the current time is within the daylight saving time, running the clock timezone time-zone-name { add | minus } offset command can successfully set the time zone name. If the display clock command is run to view the time zone name at the moment, the time zone name, however, is displayed as the name of the daylight saving time. After the daylight saving time ends, the set time zone name can be displayed.

  4. Optional: Display the system time.

    display clock [ utc ]

Synchronizing the Time with the NTP Server

The administrator can synchronize the time of the Network Time Protocol (NTP) server as the device system time.

In the example, the FW functions as an NTP client to synchronize time from the NTP server. For details on NTP, see NTP.

  1. Access the system view.

    system-view

  2. Optional: Configure the local source interface that sends the NTP packet.

    ntp-service source-interface interface-type interface-number [ vpn-instance vpn-instance-name ]

  3. Set the IPv4 or IPv6 address of the NTP server.

    • ntp-service unicast-server ip-address [ version number | [ authentication-keyid key-id | autokey ] | source-interface interface-type interface-number | preference | vpn-instance vpn-instance-name | maxpoll max-number | minpoll min-number | burst | iburst | preempt | port port-number ] *
    • ntp-service unicast-server ipv6 ipv6-address [ [ authentication-keyid key-id | autokey ] | source-interface interface-type interface-number | preference | vpn-instance vpn-instance-name | maxpoll max-number | minpoll min-number | burst | iburst | preempt | port port-number  ] *

    Step 2 is optional. If source-interface is specified in Step 3, use it preferentially.

    ip-address or ipv6-address is the IP address of the NTP server. It can be the IP address of the host rather than a broadcast address, a multicast address, or the IP address of the reference clock.

    When the unicast NTP server is specified, the local FW functions as the client automatically. The server needs to be configured with only a primary clock.

  4. Optional: Set the daylight saving time.
    1. Run the quit command to access the user view.
    2. Run the clock daylight-saving-time time-zone-name one-year start-time start-date end-time end-date offset or clock daylight-saving-time time-zone-name repeating start-time { { first | second | third | fourth | last } weekday month | start-date } end-time { { first | second | third | fourth | last } weekday month | end-date } offset [ start-year [ end-year ] ] command to set the daylight saving time.

      During the configuration of the daylight saving time, you can configure the start time and end time in one of the following modes: date+date, week+week, date+week, and week+date. For details, see clock daylight-saving-time.

      When the current time is within the daylight saving time, running the clock timezone time-zone-name { add | minus } offset command can successfully set the time zone name. If the display clock command is run to view the time zone name at the moment, the time zone name, however, is displayed as the name of the daylight saving time. After the daylight saving time ends, the set time zone name can be displayed.

  5. Optional: Display the system time.

    display clock [ utc ]

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic