TABLE OF CONTENTS

Introduction

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:

  1. access a shell with root access
  2. check the system initialization file
  3. update the system date and time using the date command
  4. 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

Using the date Command

The 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.

date [[[[CC]YY]MM]DD]hhmm[.SS]

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 setuse command
date and time (if the date is wrong)date 202011051436.51
time only (if the date is correct)date 1436.51

Using the rtc Command

The 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 timethe hardware clock is in UTC
rtc -l hwrtc hw

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.

The 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