[Previous] [Contents] [Next]

rtc

Set or get date from realtime clock (QNX)

Syntax:

Update the current time based on the time from the specified clock:

   rtc [-l] [-r rate] [-S seconds]  clock_type

Set the time of the specified clock to the current time:

   rtc -s [-l] clock_type

Options:

-l
("el") Set hardware time to local time, not Coordinated Universal Time (UTC). UTC is the standard term for Greenwich Mean Time (GMT). -l has no effect if the clock_type is net.
-r rate
Rate at which to adjust the OS time if it is currently within 60 seconds (or value set by -S) of the time from the source specified by clock_type. The rate is turned into a ratio 1/rate. The default rate is 100 (1/100 = 1%).
-s
Set hardware to current date and time.
-S seconds
Specify maximum number of seconds difference between current time and new time before jam loading rather than slowly adjusting. (see -r for the convergence speed). Default: 60.
clock_type
One of the following:
Clock type  Description
hw hardware clock (automatically selects one of at or ps2)
net [node] a node on a QNX network (node 1 is used unless otherwise specified)
at (deprecated) IBM PC/AT Compatible hardware clock
ps2 (deprecated) IBM PS/2 Compatible hardware clock

Description:

The rtc command gets or sets the date and time from a battery backed-up hardware clock or from another QNX node.

If your machine has a built-in clock/calendar, you should include the following command in your /etc/config/sysinit file:

    rtc hw

If the time in your hardware clock is incorrect (perhaps the battery has been replaced), you can set the time using the -s (set) option. First, set the QNX time with the date utility. Then, issue the appropriate rtc command. For example:

    rtc -s hw

If the Proc manager on your machine has recognized a new machine type that your version of rtc does not know about, rtc hw will fail. If this happens, contact QNX Software Systems to let them know about the problem, and work-around it until a new version of rtc is made available by using one of the deprecated overrides i.e. specifying at or ps2 instead of hw.

You can use clock type net [node] to get the date from a specified node, or to set the date on a specified node. If node isn't specified, the default is node 1. When clock type net [node] is used, the -l option has no effect.

Examples:

Update the current date and time from the hardware clock:

    rtc hw

Set hardware clock with current date and time:

    rtc -s hw

Update the current date and time on the local node from the current date and time on node 1:

    rtc net

Update the current date and time on the local node from the current date and time on node 5:

    rtc net 5

Set current date and time on node 5 to the current date and time on the local node:

    rtc -s net 5

Exit status:

0
Successful.
>0
An error occurred.

Caveats:

Past releases of the rtc utility had varying behavior with respect to the year 2000 and the CMOS century byte. As of the printing of this document, the rtc program neither utilizes nor sets the century byte in the CMOS RAM. However, the BIOS and other operating systems may use the century byte and many BIOSes fail to handle the year 2000 rollover correctly. If you use the same machine for both QNX and other operating systems, contact your BIOS manufacturer and/or operating system vendor for information on any procedures that need to be followed to assure correct operation of those products.

Detailed information on the year 2000 as it pertains to current and past releases of the QNX operating system is available in a product bulletin on the QNX web site (http://www.qnx.com).

See also:

clock, date


[Previous] [Contents] [Next]