How to Set the Time Zone of a Real-Time Controller

Updated Jun 1, 2021



  • LabVIEW Real-Time Module

Operating System

  • LabVIEW Real-Time (NI Linux Real-Time)
  • Phar Lap

This article explains the steps to follow to configure a Real-Time controller's time zone and include three different approaches to change the timezone depending on the application and the developer implementations and interests. 

After following the steps listed in this document, you should be able to configure your current time zone and get the correct time stamps in graphs, data structures, data logs, among others. 

By default, the Real-Time controller is set to Coordinated Universal Time (UTC). You can configure the time zone using one of the following methods:
  1. Using Measurement & Automation Explorer (MAX).
  2. Modifying the INI file.
  3. Using NI System Configuration APIs.

Measurement & Automation Explorer:

Select the desired time zone in Measurement & Automation Explorer (MAX) on the Time Settings tab of the Real-Time target.


Modifying the INI File (for VxWorks or Phar Lap ETS Real-Time Targets only):

The following method is limited to Phar Lab & VxWorks based targets. If your device is running NI Linux RT, please follow the steps listed in this article, if not please continue.

The time zone of a Real-Time controller can also be changed by modifying the RTTarget.TimeZone token in the ni-rt.ini. The token can be found in the [LVRT] section of the ni-rt.ini file. 
  1. Use WebDAV or FTP to copy the ni-rt.ini file from the Real-Time controller to the development computer.
  2. Open the ni-rt.ini file in a text editor (for example Notepad).
  3. At the top of the file, there is a section named [LVRT] which is where the RTTarget.TimeZone token may be found or added.
  4. To change the time zone either add or modify the RTTarget.TimeZone token to the INI file.
    • For example, use INI token RTTarget.TimeZone=CST6CDT to set the controller to the Central United States time zone. Available INI values are listed in the table below.
      INI Value    Time Zone    UTC Offset
      CUT0GDTCoordinated Universal TimeUTC
      GMT0BSTUnited KingdomUTC
      AZOREST1AZOREDTAzores, Cape Verde    UTC-1
      FALKST2FALKDTFalkland Islands    UTC-2
      GRNLNDST3GRNLNDDTGreenland, East Brazil    UTC-3
      AST4ADTCentral Brazil    UTC-4
      EST5EDTEastern United States, Colombia    UTC-5
      CST6CDTCentral United States, Honduras    UTC-6
      MST7MDTMountain United States    UTC-7
      PST8PDTPacific United States, Yukon    UTC-8
      HST10HDTHawaii, Aleutian Islands    UTC-10
      BST11BDTBering Strait    UTC-11
      NZST-12NZDT    New Zealand    UTC+12
      MET-11METDT    Solomon Islands    UTC+11
      EET-10EETDT    Eastern Australia    UTC+10
      JST-9JSTDT    Japan    UTC+9
      KORST-9KORDT    Korea    UTC+9
      WAUST-8WAUDT    Western Australia    UTC+8
      TAIST-8TAIDT    TaiwanUTC+8
      THAIST-7THAIDT    ThailandUTC+7
      TASHST-6TASHDT    Central Asia    UTC+6
      PAKST-5PAKDT    PakistanUTC+5
      WST-4WDT    Gorki, Central Asia, Oman    UTC+4
      MEST-3MEDT    Turkey    UTC+3
      SAUST-3SAUDT    Saudi Arabia    UTC+3
      WET-2WET    FinlandUTC+2
      USAST-2USADT    South Africa    UTC+2
      NFT-1DFT    NorwayUTC+1
  5. Save the file as ni-rt.ini locally (such as the desktop). Be sure the file is named ni-rt.ini.
  6. Use WebDAV or FTP to transfer the file back to the Real-Time controller.
  7. Reboot the Real-Time controller.

Note: Linux Real-Time targets support the tz (or Olson) database. The database contains all the needed information about DST settings for specific time zones. The RTTarget.DSTRule INI token cannot be changed to alter DST rules on Linux RT targets.

NI System Configuration APIs:

LabVIEW 2012 Real-Time Module and later:
The LabVIEW 2012 Real-Time Module introduced the NI System Configuration API, which can be used to programmatically set the time zone of a Real-Time Controller using the Set Time VI.

The input timezone string for the Set Time VI needs to be of the form Etc/GMT-X where positive values for X represent hours west of the GMT. For example, Etc\GMT+6 is the equivalent to Central Standard Time in the US. Valid values range from 12 to -13 centered around GMT. For more information on how to set time zones see the Set Time (VI) help

Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.

If the above code snippet is executed on the Real-Time target, the Target parameter must have a value of localhost. Otherwise, error -2147467263 will be thrown (NI System Configuration: This operation is not implemented for this target or resource).

LabVIEW 2011 Real-Time Module and Previous:
The LabVIEW 2011 Real-Time Module and previous Real-Time Modules do not include support for setting a specific time zone. Instead, it is recommended to set time programmatically using the RT Set Date and Time VI.

Note: VxWorks and Pharlap targets must be restarted for the time zone settings to apply. NI Linux Real-Time targets do not require a restart. Configuring the time zone also activates the daylight saving feature of the controller.