TABLE OF CONTENTS
- Update the System Date and Time
- Checking the System Initialization File
- Using the date command
- Using the rtc command
A properly set system date and time are desirable for accurate data logging. A hardware clock on the CPU board maintains the current date and time even when the dispenser is powered off. The system date and time on your dispenser can be incorrect for many reasons including a reset of the CMOS, improper daylight savings settings, and more.
Update the System Date and Time
To set the system date and time and save the changes to the hardware clock, use the following steps:
- access a shell with root access
- check the system initialization file
- update the system date and time using the date command
- set the hardware clock to the current system date and time using the rtc command
Checking the System Initialization File
The way the system date and time are displayed depends on the system initialization file. Before changing the date and time, you must verify the current configuration by accessing a command prompt and enter the following command:
less /etc/config/sysinit.1 | grep rtc
date command can be used to display or set the system date and time.
Use the following format when setting the date and time where
CC is the century,
YY is the year,
MM is the month,
DD is the day,
hh is the hour,
mm is the minute, and
SS is the second; each number is always two (2) digits. Only the hour and minute are required.
Changing the date requires root access.
For example, if the current date is 11/5/2020 and the current time is 2:36:51 PM, you could use one of the following commands to set the system date and time to the actual time.
|to set||use command|
|date and time (if the date is wrong)|
|time only (if the date is correct)|
rtc (real-time clock) command allows the operating system date and time to interface with the hardware clock.
During startup (see Checking the System Initialization File above), the
rtc command links the current hardware time to the system date and time. This is handled in the system initialization file with one of the following commands.
|the hardware clock is in local time||the hardware clock is in UTC|
If the hardware clock is using UTC, the clock can update for daylight savings time automatically.
To write the system date and time to the hardware clock, the set command is used. The hardware clock must be set with the same local time option as the system initialization file.
rtc command requires root access.
If the system initialization file indicates the hardware clock is set to local time, use this command to set the hardware clock:
rtc -ls hw
If the system initialization file indicates the hardware clock is set to UTC, use this command to set the hardware clock:
rtc -s hw