xclock Command

Purpose

Continuously displays the current time of day.

Syntax

xclock [  -Xtoolkitoption ... ] [  -analog -digital ] [  -chime ] [  -hd Color ] [  -help ] [  -hl Color ] [  -padding Number ] [  -update Seconds ]

Description

The xclock command gets the time from the system clock, then displays and updates it in the form of a digital or analog clock. Select the -analog or -digital flag to display the clock in analog or digital formats. You can also select flags to specify the presentation of the clock, including chime and update frequency, colors, and border width.

This command uses the Athena clock widget, which understands core resource names and classes. To specify these resources, you need to know the hierarchy of the widgets that comprise the xclock command. In the following example, the indented items indicate the hierarchical structure. The widget class name is given first, followed by the widget instance name:

XClock xclock
Clock clock

The following examples demonstrate the possible ways to specify resources for this client:

xclock.clock.background
XClock*background
xclock*background

Note: Specifying resources as xclock.background which worked with the previous version of xclock will not work with this version.

Flags

Item Description
-Xtoolkitoption The xclock command accepts all of the standard X Toolkit command-line option flags in addition to the specific flags listed.

You can view standard X Toolkit command-line option flag the in the custom command.

-analog Sets the analog display mode, which is the default mode. Draws a conventional 12-hour clock face with ticks for each minute and stroke marks on each hour.
-chime Specifies the sounding of a chime once on the half hour and twice on the hour.
-digital Sets the 24-hour digital display mode. Displays the date and time in digital form.
-hd Color Specifies the color of the hands in analog mode on color displays. The default is black.
-help Prints a brief summary of the allowed options.
-hl Color (lowercase HL) Specifies the highlight color of the edges of the hands of the analog clock. The default is black.
-padding Number Specifies the width in pixels of the padding between the window border and the clock text or picture. The default is 8.
-update Seconds Specifies the frequency in seconds that the xclock command updates its display. If the xclock window is obscured and then exposed, the xclock command redisplays immediately. The specification of an update frequency less than 30 seconds enables the second hand in the analog mode. The default update frequency is 60 seconds.

.Xdefaults Keywords

Use the following keywords to set the defaults for the xclock command.

Item Description
analog (class Boolean) Specifies an analog clock instead of a digital clock. The default is true.
chime (class Boolean) Specifies whether a bell sounds on the hour and half hour.
fontSet (class FontSet) Specifies the fontset for the digital clock. Variable-width fonts do not always display correctly.
foreground (class Foreground) Specifies the color of tick marks on color displays. If reverseVideo is specified, the default is white, otherwise the default is black.
hands (class Foreground) Specifies the color on the inside of the hands in the analog clock on color displays. If reverseVideo is specified, the default is white, otherwise the default is black.
highlight (class Foreground) Specifies the color used to highlight the clock's hands. If reverseVideo is specified, the default is white, otherwise the default is black.
height (class Height) Specifies the height of the clock. The default for the analog clock is 164 pixels. The default for the digital clock is whatever is required to hold the clock when displayed in the chosen font.
padding (class Margin) Specifies the amount of internal padding in pixels. The default is 8.
update (class Interval) Specifies the frequency in seconds in which the xclock command updates its display.
width (class Width) Specifies the width of the clock. The default for the analog clock is 164 pixels. The default for the digital clock is whatever is needed to hold the clock when displayed in the chosen font.

Environment Variables

Item Description
DISPLAY Gets the default host and display number.
XENVIRONMENT Gets the name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property.

Examples

  1. To specify a digital clock display, enter:
    xclock -digital
  2. To specify red hands on an analog clock, enter:
    xclock -hd red

File

Item Description
/usr/lib/X11/app-defaults/XClock Specifies the required resources.