<< to CrossControl homepage

Support & Service Center

Set Time and Date on displays

Printer-friendly versionPrinter-friendly versionPDF versionPDF version

The time and date settings in the Linux OS are also used by the QDateTime class inside of Qt.  This means to display the correct time and date within Qt you will first need to set it in Linux.

To do this we will first understand the difference between the hardware date and time versus the system date and time.

Hardware Date/Time:  This is the RTC on the display and runs independently of Linux.  If the display is connected to a power source this clock will run even when the display is turned off.

System Date/Time: This is time kept by a clock inside the Linux kernel.  It will not continue to run when the display is shut off and should be synced with the hardware RTC to ensure it has the correct time (more on this below).

When setting the date and time in the display you should set the hardware date and time to ensure the clock runs independently of display power (assuming it is connected to a power source when turned off to continue running the RTC).  To set the hardware date and time in the Linux OS go through the following steps:

1) Set the system date and time with:


Where Y above is the four digit year, M is the two digit month, D is the two digit day, H is the two digit hour (in 24H format) and M is the two digit minute.  So, for example, to set the current date and time to be September 17th 2015 at 1:58 pm we would type 'date -s 201509171358' into the Linux command line.  You can confirm the date and time settings     have correctly set by typing 'date' into the Linux command line.

2) Sync the hardware date and time with the system date and time:

# hwclock --systohc

The above command will sync the system date and time that you have set in step 1 to the hardware date and time.  Now the hardware date and time has been set and the RTC will keep the correct time as long as it has power.

Ubuntu time/date modification (XM1):

The XM1 using Ubuntu the time and date modification is slightly different.  By default, when connected to another system via Ethernet the Ubuntu OS will sync the time and date with the connected system.   This means even if the time and date is set, it will change once plugged into another system via Ethernet.  To stop the time and date from being synced when connected via Ethernet:

  • Log into the display via ssh
  • Modify the '/etc/default/ntpdate' file so the first line of the file reads 'exit' (you can modify the file with the 'sudo nano' command)
  • Save and exit the file

You can change the time and date in Ubuntu with:

# sudo date --set="YYYY-MM-DD HH:MM:SS"

Sync this date with the system date and time as described above with the 'sudo hwclock --systohc' command.


  • When the display is connected to a computer via Ethernet it will automatically sync its system time to the system time of your computer.  It is a good idea in your application to sync the hardware time to the system time during application initialization.  This will make sure the system time and hardware or RTC time is the same.  This can be done with this command 'hwclock --hctosys'.
  • To issue Linux commands (for setting and syncing the clocks) in your Qt application look at the QProcess class inside Qt
  • Use the QDateTime class inside Qt to display the date and time