Set or get date from realtime clock (QNX Neutrino)
You must be root to run this utility. |
Update the current time based on the time from the specified clock:
rtc [-b [base][,[reg_shift][,[mem_map][,c_offset]]]] [-l] [-r rate] [-S seconds] clock_type
Set the time of the specified clock to the current time:
rtc [-b [base][,[reg_shift][,[mem_map][,c_offset]]]] -s [-l] clock_type
...
The default reg_shift is 0.
Clock type | Description |
---|---|
hw | Hardware clock (automatically selects one based on information provided by the startup) |
at (deprecated) | IBM PC/AT Compatible hardware clock |
ds1386 | Embedded Dallas Semiconductor DS1386 |
ps2 (deprecated) | IBM PS/2 Compatible hardware clock |
rtc72423 | Embedded Fox RTC-72423 |
rtcsh4 | Integrated into the Hitachi SH4 7750/7751 cpus |
mc146818 | IBM PC/AT Compatible hardware clock |
m48t5x | STMicroelectronics TIMEKEEPER Series clock |
net [node] | Hardware clock on a remote node |
The rtc command gets or sets the date and time from a battery backed-up hardware clock.
If your machine has a builtin clock/calendar, you should include the following command in your startup script so QNX Neutrino automatically reads the time when the system starts:
rtc hw
If the RTC chip has been set to the UTC timezone, startup sets the correct time of day automatically on booting. If the RTC chip is set to local time, or for some reason startup doesn't know where the RTC chip is, you'll need to include the appropriate rtc command in the startup script specified in your mkifs buildfile.
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 the local machine. When clock type net [node] is used, the -l option has no effect.
Be careful if you set the date during the period that a time zone is switching to daylight saving time (DST). When a time zone changes to DST, the local time goes back one hour (for example, 2:00 a.m. becomes 1:00 a.m.). The local time during this hour is ambiguous (e.g. 1:14 a.m. occurs twice in the morning that the time zone switches to DST). To avoid problems, use UTC time to set the date in this period. |
Update the current date and time from the hardware clock:
rtc hw
Set hardware clock with current date and time:
rtc -s hw