System time

Default time zone

All PLCnext Control devices are set by default to UTC0 which is UTC±00:00 of the Coordinated universal time (UTC). 

Note: Time stamps created by OPC UA or DataLogger are always UTC0.

Changing the system time on a controller

Setting via PLCnext Engineer

You can set the system time using the PLCnext Engineer software.  Access to the controller with PLCnext Engineer requires authentication with a user name and password.

Defining RTC parameters

  • In the PLANT area, click on PLCnext.
  • In the Online Parameters tab, select the Real time clock section.
  • Enter the desired values in the corresponding input fields (see the circled ℹ for formats)

Using the Clock button in the PLCnext Engineer cockpit

With the clock-shaped button you can write the current system time of the host computer to the real-time clock on the controller to be the controller's UTC0 time.

Note: The controller will ignore any given offset or time zone!

Currently, the only way to work with an offset to UTC0 or with a specific time zone (which automatically switches to/from daylight savings time) on PLCnext devices is using the PLCnextBase library out of the PLCnext Engineer.

Setting via shell

You can also change the system time manually via the shell. Authentication with user name and password is necessary for SSH access to the shell. Access with administrator rights:

  • User name: admin
  • Password: The default password is printed on the controller's housing. 
    Security shield Security note: Use the default admin password only for initial access and change it as soon as possible!

Requesting the system time

  • Open the shell.
  • Request the system time via the date command.

Setting the system time

  • Enter shell command sudo date -s "YYYY-MM-DD hh:mm:ss", with
    • YYYY: year
    • MM: month
    • TT: day
    • hh: hours
    • mm: minutes
    • ss: seconds

Using the NTP client

It is possible to connect to Network Time Protocol (NTP) servers or to start your own server. 

NTP servers can be configured via PLCnext Engineer or via RSC services.

Setting via PLCnext Engineer

  • In the PLANT area, click on PLCnext
  • In the Online Parameters tab, select the NTP section
  • Enter up to 3 NTP servers (separated by spaces) in the input field
  • Reboot the PLCnext device for changes to be effective

Setting via shell

An ntpd (Network Time Protocol daemon) from the Network Time Protocol project (see ntp.org) is integrated into the operating system.

  • To have sufficient rights to modify the data, log on to the controller as the admin user.
  • Navigate to the /etc/ directory.
  • In the ntp.conf configuration file, specify IP addresses and names.
    Note: The same file is also used by the WBM.
  • Restart the NTP daemon by executing the command
    sudo /etc/init.d/ntpd

Additional information

  • Find a general overview to the Network Time Protocol daemon (ntpd) in the developer's introduction.
  • Find a detailed description of the configuration options in the developer's documentation.
  • The PLCnext Runtime System already contains the NTP utilities (e.g. ntpq and ntpdc) for diagnostic and monitoring purposes.

Using NTP and time settings via PLCnextBase library

Another way to set the system time is the PLCnextBase library, provided in the PLCnext Store for free and without needing a license.  After importing this library into PLCnext Engineer, it provides several functions, function blocks, and programs that are helpful in developing PLCnext-based automation solutions. It comes with instructions for import and setup, as well as detailed descriptions of the IEC 61131‑3 interface and all components.

For the system time, the PLCnextBase library depends on the native Linux® features. After importing this library in PLCnext Engineer, you can work with local time settings by reading the time zone along with the local offset to UTC, and automatically switch to and from daylight savings time.

Note: Time stamps created by OPC UA or DataLogger are always UTC0.

NTP client configuration via WBM

Available from 2022.0 LTS

The NTP client can be configured via the Date and Time WBM page.

 


• Published/reviewed: 2024-12-19  ☃  Revision 076 •