LC_TOD category
The LC_TOD category defines the rules used to define the start and end time of daylight saving time (DST), the difference between local time and Greenwich Mean time, the time zone name, and the DST name. This category is an IBM® extension and must appear after all other category definitions in the source file.
- System locale files (such as /QSYS.LIB/EN_US.LOCALE) that IBM provides do not have LC_TOD information filled in. This is because the same locale source (for example, EN_US) can be used for many different time zones and, therefore, no sets of values can be used as the default for every time zone.
- The values specified in the LC_TOD category are only reflected in the C functions that process time. These values do not affect a job's time, which is set by a time zone object.
The LC_TOD locale time definitions are used only by applications that use locale-sensitive APIs, which are often application code that is based on C and C++ programming languages. Traditional system code (for example, DSPJOB) does not use the locale LC_TOD information.
RPG and COBOL applications have several ways if they need to use the LC_TOD information in a program:
- They can use the locale-sensitive APIs found in C run time.
- They can use the QlgRetrieveLocaleInformation API to retrieve locale information and do their own date and time formatting independent of the C runtime support.
- They can use system APIs, such as Convert Date and Time Format (QWCCVTDT), to map system time to local time. The QWCCVTDT API supports the specification of a time zone object when performing date and time conversions.
All the operands for the LC_TOD category are defined as string or integer values. String values are bounded by quotation marks (""). All values are separated from the keyword they define by one or more spaces. Two adjacent quotation marks indicate an undefined string value. A 0 (zero) indicates an undefined integer value. The following keywords are recognized in the LC_TOD category.
- tzdiff
- The time zone difference in minutes. It is the difference between the local time and Greenwich mean time.
- tname
- The string used for the time zone name.
- dstname
- The string used for the DST name.
- dststart
- A set of 4 integers that represents the DST start date. The operand
for the dststart keyword consists of a sequence of four integers separated
by comma.
dststart keyword format month,week,day,time The variables for the dststart format are defined as follows:
- month
- An integer value that represents the month of the year when DST takes effect. This value ranges from 1 to 12, with 1 corresponding to January, and 12 corresponding to December.
- week
- An integer value that represents the week of the month when DST
takes effect. This value ranges from -4 to 4, with -4 corresponding
to the fourth week of the month counting from the end of the month
and 4 corresponding to the fourth week of the month counting from
the beginning of the month.Note: You can specify zero for week. This means that the day indicates the day of the month rather than the day of the week. For example, the string 4,0,23,0 means that DST starts the fourth month of the year, the twenty-third day of the month, and 0 seconds after midnight local standard time.
- day
- An integer value that represents the day of the month when DST takes effect. If the week keyword is not 0 (zero), then this is the day of the week when DST takes effect. This value ranges from 1 to the last day of the month or 1 to the last day of the week.
- time
- An integer value that represents the number of seconds after 12 midnight, local standard time, when DST takes effect. This value ranges from 0 to 86399.
- dstend
- A set of 4 integers that represents the DST end date. The operand
for the dstend keyword consists of a sequence of four integers that
are separated by comma.
dstend keyword format month,week,day,time The variables for the dstend format are defined as follows:
- month
- An integer value that represents the month of the year when DST ends. This value ranges from 1 to 12, with 1 corresponding to January, and 12 corresponding to December.
- week
- An integer value that represents the week of the month when DST ends. This value ranges from -4 to 4, with -4 corresponding to the fourth week of the month counting from the end of the month and 4 corresponding to the fourth week of the month counting from the beginning of the month.
- day
- An integer value that represents the day of the month when DST ends. If the week keyword is not 0 (zero), then this is the day of the week when DST ends. This value ranges from 1 to the last day of the month or 1 to the last day of the week.
- time
- An integer value that represents the number of seconds after 12 midnight, local standard time, when DST takes effect. This value ranges from 0 to 86399.
- dstshift
- An integer value that represents the DST shift value in seconds.
Example
Here is an example of the LC_TOD category in a locale definition source file.
LC_TOD
#
tzdiff 360
tname "<C><S><T>"
dstname "<C><D><T>"
#Set daylight saving time to start on 3rd week of October at
#midnight on Saturday.
dststart 10,3,6,0
#Set daylight saving time to end on April 23, at midnight.
dstend 4,0,23,0
dstshift 3600
#
END LC_TOD