Clock Commands

This chapter contains the following sections:

absolute

Use the absolute Time-range Configuration mode command to specify an absolute time when a time range is in effect.

Use the no form of this command to remove the time limitation.

Syntax

absolute (end | start) HH:MM (jan | feb | mar | apr | may | jun | jul | aug | sep | oct | nov | dec) <1-31> <2000-2037>

Parameters

start—Absolute time and date that the permit or deny statement of the associated function going into effect. If no start time and date are specified, the function is in effect immediately.

end—Absolute time and date that the permit or deny statement of the associated function is no longer in effect. If no end time and date are specified, the function is in effect indefinitely.

hh:mm—Time in hours and minutes

day—Day in the month.

month—Month

year—Year

Default Configuration

No default is defined.

Command Mode

Global Configuration mode

User Guidelines

Use the absolute command to set the absolute time of time range.

Use the no form of this command to remove start or end time.

You can verify your setting by entering the show time-range Privileged EXEC command.

Example

The following example shows how to set absolute time:

switchxxxxxx(config)#loopback-detection enable
switchxxxxxx (config)# time-range test
switchxxxxxx (config-time-range)# absolute start 09:00 feb 01 2015
switchxxxxxx (config-time-range)# absolute end 18:00 oct 31 2015
switchxxxxxx (config-time-range)# do show time-range test
time-range entry: test (active)
absolute start 09:00 feb 1 2015
absolute end 18:00 oct 31 2015	
switchxxxxxx (config-time-range)# no absolute start
switchxxxxxx (config-time-range)# do show time-range test
time-range entry: test (active)
absolute end 18:00 oct 31 2015

clock set

To manually set the system clock, use the clock set Privileged EXEC mode command.

Syntax

clock set HH:MM:SS month day year

Parameters

HH:MM:SS—The current time in hours (military format), minutes, and seconds. (Range: HH: 0 to 23, MM: 0 to 59, SS: 0 to 59)

month—The current month using the first three letters of the month name. (Range: jan–dec)

day—The current day of the month. (Range: 1 to 31)

year—The current year. (Range: 2000 to 2037)

Command Mode

Privileged EXEC mode

Example

The following example sets the system time to 13:32:00 on August 7, 2014:

switchxxxxxx# clock set 13:32:00 aug 7 2014
13:32:00 DFL(UTC+8) Aug 07 2014

clock source

To configure an external time source for the system clock, use the clock source Global Configuration mode command.

Syntax

clock source {sntp | local}

Parameters

sntp—Specifies an SNTP server as the external clock source.

local—Specifies the local time settings.

Default Configuration

The default is to use the local time as the source of the system clock.

Command Mode

Global Configuration mode

Example

The following example configures the SNTP server as an external time source:

switchxxxxxx(config)# clock source sntp

clock summer-time

To enable the switch to automatically switch to the summer time (Daylight Saving Time), use the clock summer-time Global Configuration mode command.

To disable this feature, use the no form of this command.

Syntax

clock summer-time zone recurring {usa | eu | {week date month HH:MM week month date HH:MM}} [offset]

clock summer-time zone date month day year HH:MM month day year HH:MM [offset]

no clock summer-time

Parameters

zone—The acronym of the time zone to be displayed when the summer time is in effect. (Range: up to 4 characters)

recurring—Specifies that the summer time starts and ends on the corresponding specified days every year.

  • usa—Specifies that the summer time rules are the United States rules.

  • eu—Specifies that the summer time rules are the European Union rules.

  • week—Number of the week in the month (1 to 4), first, or last.

  • date—Date of the week (first three characters by name, such as sun).

  • month—Month (first three characters by name, such as feb).

    date—Specifies that the summer time starts on the first date listed in the command and ends on the second date in the command.

  • month—Starting month (first three characters by name, such as feb).

  • day—Starting date. (Range: 1 to 31)

  • year—Starting date (no abbreviation). (Range: 2000 to 2037)

  • HH:MM—Starting time (military format) in hours and minutes. (Range: hh: 0 to 23, mm: 0 to 59)

    offset—(Optional) Number of minutes to add during the summer time. The default is 60 minutes. (Range: 1 to 1440)

Default Configuration

The summer time is disabled.

Command Mode

Global Configuration mode

User Guidelines

In both the date and recurring forms of the command, the first part of the command specifies when the summer time begins, and the second part specifies when it ends. All times are relative to the local time zone. The start time is relative to the standard time. The end time is relative to the summer time. If the starting month is chronologically after the ending month, the system assumes that you are in the southern hemisphere.

Example

switchxxxxxx(config)# clock summer-time abc date apr 1 2010 09:00 aug 2 2010 09:00

clock timezone

To set the time zone of the switch, use the clock timezone Global Configuration command.

To use the default time zone, use the no form of this command.

Syntax

clock timezone zone HOUR-OFFSET [minutes]

no clock timezone

Parameters

zone—The acronym of the time zone. (Range: Up to 4 characters)

HOUR-OFFSET—Hours difference from UTC. (Range: -12 to +13)

minutes—(Optional) Minutes difference from UTC. (Range: 0 to 59)

Default Configuration

HOUR-Offset is +8. Acronym is DFL.

Command Mode

Global Configuration mode

User Guidelines

The system internally keeps time in UTC, so this command is used only for display purposes and when the time is manually set.

Example

switchxxxxxx(config)# clock timezone abc +2 minutes 32

show time-range

Use the show time-range User EXEC mode command to display the time range configuration

Syntax

show time-range [NAME]

Parameters

NAME—Name of time-range entry

Default Configuration

No default is defined.

Command Mode

Privileged EXEC mode

User Guidelines

Use the show time-range command to display time range entry settings.

Example

The following example shows how to show a time-range entry:

Switchxxxxxx# show time-range test
time-range entry: test (active)
absolute end 22:00 may 30 2015
periodic mon 18:00 to wed 22:00
periodic weekend 09:00 to 11:00

periodic

Use the periodic Time-range Configuration mode command to specify a recurring (weekly) time range for functions that support the time-range feature. Use the no form of this command to remove the time limitation.

Syntax

periodic (sun | mon | tue | wed | thu | fri | sat) HH:MM to (sun | mon | tue | wed | thu | fri | sat) HH:MM

no periodic (sun | mon | tue | wed | thu | fri | sat) HH:MM to (sun | mon | tue | wed | thu | fri | sat) HH:MM

periodic (daily | weekdays | weekend) HH:MM to HH:MM

periodic (sun | mon | tue | wed | thu | fri | sat) | [(sun | mon | tue | wed | thu | fri | sat)] |
[ (sun | mon | tue | wed | thu | fri | sat) ] | [(sun | mon | tue | wed | thu | fri | sat)] | [(sun | mon | tue | wed | thu | fri | sat) ] | [(sun | mon | tue | wed | thu | fri | sat)] | [(sun | mon |
tue | wed | thu | fri | sat) ] HH:MM to HH:MM

no periodic (daily | weekdays | weekend) HH:MM to HH:MM

no periodic (sun | mon | tue | wed | thu | fri | sat) | [(sun | mon | tue | wed | thu | fri | sat)] | [ (sun | mon | tue | wed | thu | fri | sat) ] | [(sun | mon | tue | wed | thu | fri | sat)] | [(sun | mon | tue | wed | thu | fri | sat) ] | [(sun | mon | tue | wed | thu | fri | sat)] | [(sun | mon | tue | wed | thu | fri | sat) ] HH:MM to HH:MM

Parameters

weekdays—The starting day that the associated time range is in effect. The second occurrence is the ending day the associated statement is in effect. The second occurrence can be the following week (see description in the User Guidelines)..

hh:mm—Time in hours and minutes.

daily | weekdays | weekend—Specifies periodic range type .

Default Configuration

No default is defined.

Command Mode

Time-Range Configuration Mode

User Guidelines

Use the periodic command to set the periodic time of time range.

Use the no form of this command to remove periodic time.

You can verify your setting by entering the show time-range Privileged EXEC command

Example

The following example shows how to set periodic time:

switchxxxxxx (config)# time-range test
switchxxxxxx (config-time-range)# periodic mon 11:00 to fri 18:00
switchxxxxxx (config-time-range)# periodic wed 14:00 to fri 22:00
switchxxxxxx (config-time-range)# do show time-range test
time-range entry: test (active)
periodic mon 11:00 to fri 18:00	
periodic wed 14:00 to fri 22:00
switchxxxxxx (config-time-range)# no periodic mon 11:00 to fri 18:00
switchxxxxxx (config-time-range)# do show time-range test
time-range entry: test (inactive)
periodic wed 14:00 to fri 22:00

show clock

To show the system time and date, use the show clock Privileged EXEC mode command.

Syntax

show clock [detail]

Parameters

detail—(Optional) Displays the time zone and summer time configuration.

Command Mode

Privileged EXEC mode

Examples

Example 1—The following example displays the system time and date:

switchxxxxxx# show clock
08:11:18 abc(UTC+2:32) Mar 07 2012
Time source is sntp

Example 2—The following example displays the system time and date along with the time zone and the summer time configuration:

switchxxxxxx# show clock detail
08:11:44 abc(UTC+2:32) Mar 07 2012
Time source is sntp
Time zone:
Acronym is abc
Offset is UTC+2:32

show sntp configuration

To show the SNTP server defined on the switch, use the show sntp configuration Privileged EXEC mode command.

Syntax

show sntp configuration

Parameters

N/A

Command Mode

Privileged EXEC mode

Example

switchxxxxxx# show sntp configuration
SNTP is Enabled
SNTP Server address: 192.1.1.1
SNTP Server port: 123

sntp server

To use SNTP to request and accept Network Time Protocol (NTP) traffic from a specific server (meaning to accept system time from an SNTP server), use the sntp server Global Configuration mode command.

To remove the SNTP server, use the no form of this command.

Syntax

sntp server {ip-address | hostname} [port port-number]

no sntp

Parameters

ip-address—IPv4 address of the SNTP server.

hostname—Hostname of the SNTP server. Only translation to IPv4 addresses is supported.

port port-number—(Optional) Specifies the logical port number used for the SNTP client on the switch. The default is the well-known IANA port number for this service, 123. (Range: 1 to 65535)

Default Configuration

No SNTP servers are defined.

Command Mode

Global Configuration mode

Example

The following example configures the switch to accept SNTP traffic from the server on 192.1.1.1 with port 123:

switchxxxxxx(config)# sntp server 192.1.1.1 port 123

time-range

Use the time-range Global Configuration mode command to define time ranges different functions. In addition, this command enters the Time-range Configuration mode. All commands after this one refer to the time-range being defined.

Use the no form of this command to remove the time range from the device.

Syntax

time-range NAME

no time-range NAME

Parameters

NAME—Name of time-range entry

Default Configuration

No default is defined.

Command Mode

Global Configuration mode

User Guidelines

Use the time-range command to add time range entry.

Use the no form of this command to delete exist time range entry. Entry can't be reference by other features.

You can verify your setting by entering the show time-range Privileged EXEC command.

Example

The following example shows how to create and delete time-range entry:

switchxxxxxx (config)# time-range test
switchxxxxxx (config-time-range)# do show time-range test
time-range entry: test (active)
switchxxxxxx (config)# no time-range test
switchxxxxxx (config)# do show time-range test