Setting Time Zone and Daylight Time
eRTOS uses the TimeZone environment variable to establish the relationship between local time (target time) and the system time (UTC).
The TimeZone environment variable is configurable via the RtKrnlConfig.ini file and is taken into RT Kernel at eRTOS start-up. In RtKrnlConfig.ini file, the TimeZone line configures the TimeZone environment variable. The line consists of two components: the name, which is "TimeZone", and the value, which is a string. The default string value is set to “EST5EDT”.
Use the following syntax to configure the TimeZone line:
Syntax
TimeZone = “tzn[+|-]hh[:mm[:ss]][dzn]”
Parameters
tzn
Three-letter time-zone name, such as EST. You must specify the correct offset from local time to UTC.
hh
Difference in hours between UTC and local time. Sign (+) optional for positive values.
mm (Optional)
Minutes. Separated from hh by a colon (:).
ss (Optional)
Seconds. Separated from mm by a colon (:).
dzn
Three-letter daylight-saving-time zone such as EDT. If daylight saving time is never in effect in the locality, set TimeZone without a value for dzn. eRTOS assumes adherence to the United States' regulations for implementing daylight saving time (DST) calculations.
For example, the default “EST5EDT” uses EST to denote Eastern standard time zone. It assumes that UTC is five hours ahead of Eastern standard time, and that the United States adheres to daylight-saving time.
When the current time zone observes daylight-saving time (i.e., TimeZone contains three-letter of daylight-saving-time zone name, dzn), you need to specify whether the system is operating in the range of standard time or daylight time when eRTOS starts. eRTOS uses a Daylight state variable to take your specification. In the RtKrnlConfig.ini file, the DaylightState line configures the Daylight state variable. In that line, the name is DaylightState, and the value is a dword (0 for standard time, 1 for daylight time). The default value is 0.
eRTOS does not support automatic transition from standard time to daylight time, nor from daylight to standard time. However, you can manually trigger these transitions with the setdst shell command, or by calling SetDaylightState RTAPI at runtime.