rtc-imx8x
Set or get date from realtime clock (QNX OS)
Syntax:
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
Runs on:
QNX OS
Options:
- -a alarm_enable
- Enable or disable RTC alarm. The format of the
alarm_enable string varies depending on the clock type
being used. This
option can only be specified once per utility use (i.e., to
enable two alarms, you need to run
"rtc -a alarm_enable"
twice). alarm_enable string format is specific to the clock type:Type String format Example mx8sc
"<enable>" rtc -a1 mx8sc
pmqcom
""<enable>" rtc -a1 pmqcom
ds3232
"<alarm #>,<enable>" rtc -a1,1 ds3232
Note:Fords3232
, enabling and disabling an alarm clears the alarm's status flag; i.e. dismisses the alarm signal. Example: To enable alarm one with an active low interrupt signal, usertc -a1,1 ds3232
To disable alarm two, usertc -a2,0 ds3232
- -A alarm_time
- Set the RTC alarm to the specified time, in seconds.
The RTC alarm is disabled before setting a new value.
All other options are ignored when using other RTC alarm related
options, such as the -a option are used.
alarm_time string format is specific to the clock type:
Type String format mx8sc
"<seconds>" pmqcom
>"<seconds>" ds3232
"<alarm #>,<hh:mm:ss>[,<day of week>[,<date of month>]]" Note:Forpmqcom
, the alarm is automatically disabled after using the -A option. It must be re-enabled manually using the -a option.Note:Fords3232
, Valid values for alarm_number are 1 and 2.- If alarms are enabled, setting a new alarm does not disable the alarms.
- You cannot set ss (seconds) for alarm 2: the seconds value for that alarm is ignored.
- If <day of week> or <date of month> are 0 (zero), they are ignored.
- If <date of month> is specified, <day of week> must be specified as a "0".
- If <day of week> is a valid non-zero value, <date of month> value is safely ignored and alarm is set to weekly.
- The
ds3232
alarm modes for every second, specific seconds, or specific minutes and seconds are not supported. - Example: To set alarm 1 for 6pm every day, use
"rtc -a1,1 -A1,18:00:00"
- To set alarm 2 for 4am every Wednesday, use
"rtc -a2,1 -A2,04:00:00,4"
- To set alarm 1 for 2:30pm every 15th date of the month, use
"rtc -a1,1 -A1,14:30:00,0,15"
- -b [base][,[reg_shift][,[mem_map][,c_offset]]]
- The location of the RTC chip:
- base — the base address of the chip.
- reg_shift — spacing of the device registers as a power of 2. For example:
0
- Registers are 1 byte apart.
1
- Registers are 2 bytes apart.
2
- Registers are 4 bytes apart.
- n
- Registers are 2n bytes apart.
The default reg_shift is
0
. - mem_map — memory or I/O space.
- c_offset — offset to the century byte in NVRAM.
- -l
- (
el
) Set hardware time to local time, not Coordinated Universal Time (UTC). UTC is the standard term for Greenwich Mean Time (GMT). The -l option has no effect if the clock_type isnet
. - -r rate
- The rate at which to adjust the OS time if it's currently within 60 seconds (or the value set by -S) of the time from the source specified by clock_type. The rate is turned into a percentage 1/rate. The default rate is 100 (1%).
- -S seconds
- Specify the maximum difference, in seconds, between the current time and the new time before jam loading rather than slowly adjusting (see -r for the convergence speed). Default: 60.
- -s
- Set hardware to current date and time.
- clock_type
- One of the following:
Clock type Description hw Hardware clock (automatically selects one based on information provided by the startup) at (deprecated) IBM PC/AT Compatible hardware clock ds15x1 Embedded Dallas Semiconductor DS15x1 ds1386 Embedded Dallas Semiconductor DS1386 ds1743 Maxim Integrated real-time clock isl1208 NXP i.MX8 ISL1208 low-power real-time clock max8925 ATMEL MAX8925 hardware clock mc146818 IBM PC/AT Compatible hardware clock mc9s08dz60 NXP (Freescale) MC9S08DZ60 hardware clock pcf2127a NXP PCF2127A CMOS realtime clock pmqcom ARM PMQ clock primecell ARM PrimeCell clock ps2 (deprecated) IBM PS/2 Compatible hardware clock rtc72423 Embedded Fox RTC-72423 m41t6x STMicroelectronics TIMEKEEPER Series clock m48t5x STMicroelectronics TIMEKEEPER Series clock mt2712 Mediatek clock mx8sc NXP i.MX8 real-time clock s35390 ABLIC real-time clock net [node] Hardware clock on a remote node ultrazed UltraZed-EG SoC clock
Description:
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 OS 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.
Examples:
Update the current date and time from the hardware clock:
rtc-imx8x hw
Set hardware clock with current date and time:
rtc-imx8x -s hw
Exit status:
- 0
- Successful.
- >0
- An error occurred.