Daylight-Savings Time & Time-Zone Offset
How to read/write a DST Offset in ESPI and determine the Time Zone
Although legislation may soon make Daylight Savings Time “go away” in the USA (and become the new Standard Time), it isn’t going away everywhere.
The NAESB REQ.21 ESPI (“Green Button” core standard) includes <LocalTimeParameters>
(of type <TimeConfiguration>
) to allow data to be shared using timestamps in Coordinated Universal Time (UTC) and denoting the offset of time through a time zone and a Daylight Savings Time (DST) offset.
Bitmap of dstStartRule and dstEndRule
This is the bitmap-encoded rule from which the start or end time—within the current year, to which daylight savings time offset must be applied—is calculated:
The 32-bit rule encoding:
- Bits 28 - 31 (4 bits): month … 1 — 12
- Bits 25 - 27 (3 bits): operator … detailed below
- Bits 20 - 24 (5 bits): day of the month … 1 — 31 (where 0 = not applicable)
- Bits 17 - 19 (3 bits): day of the week … 1 — 7 (where 1 = “Monday” and 0 = not applicable)
- Bits 12 - 16 (5 bits): hours … 0 — 23
- Bits 0 - 11 (12 bits): seconds … 0 — 3599
The operators:
- 0: DST starts/ends on the Day of the Month (a particular number date)
- 1: DST starts/ends on the Day of the Week that is on or after the Day of the Month
- 2: DST starts/ends on the first occurrence of the Day of the Week in a month
- 3: DST starts/ends on the second occurrence of the Day of the Week in a month
- 4: DST starts/ends on the third occurrence of the Day of the Week in a month
- 5: DST starts/ends on the forth occurrence of the Day of the Week in a month
- 6: DST starts/ends on the fifth occurrence of the Day of the Week in a month
- 7: DST starts/ends on the last occurrence of the Day of the Week in a month
DST Examples
DST Start Example:
Example of a North American DST-Start Rule (currently for both Canada and the USA):
In a particular area, DST starts on the second Sunday of March at 2:00 AM. The rule is…
Month: 3 (“March”)
Operator: 3 (“the second occurrence of the Day of the Week in a month”)
Day of Month: 0 (“not applicable”)
Day of Week: 7 (“Sunday”)
Hours: 2 (“2:__”)
Seconds: 0 ( “__:00” or 00 minutes)
When | March | 2nd occurrence | no certain date | Sunday | 2 AM | :00 after the hour |
Decimal | 3 | 3 | 0 | 7 | 2 | 0 |
Binary | 0011 |
011_ |
0 0000 |
111_ |
0 0010 |
0000 0000 0000 |
Hexadecimal | 3 | 60 | E2 | 000 |
Then, the hexadecimal is used in the dstEndRule …
<dstEndRule>360E2000</dstEndRule>
… to be placed into a <LocalTimeParameters>
element.
DST End Example:
Example of a North American DST-End Rule (currently for both Canada and the USA):
In a particular area, DST ends on the first Sunday of November at 2:00 AM. The rule is…
Month: 11 (“November”)
Operator: 2 (“the first occurrence of the Day of the Week in a month”)
Day of Month: 0 (“not applicable”)
Day of Week: 7 (“Sunday”)
Hours: 2 (“2:__”)
Seconds: 0 ( “__:00” or 00 minutes)
When | November | 1st occurrence | no certain date | Sunday | 2 AM | :00 after the hour |
Decimal | 11 | 2 | 0 | 7 | 2 | 0 |
Binary | 1011 |
010_ |
0 0000 |
111 |
0 0010 |
0000 0000 0000 |
Hexadecimal | B | 40 | E2 | 000 |
Then, the hexadecimal is used in the dstEndRule …
<dstEndRule>B40E2000</dstEndRule>
… to be placed into a <LocalTimeParameters>
element.
<feed ... >
...
<!-- LocalTimeParameters -->
<entry>
...
<title>America/New_York</title> <!-- DST For Eastern Time, New York in North America -->
<content>
<espi:LocalTimeParameters>
<espi:dstEndRule>B40E2000</espi:dstEndRule>
<espi:dstOffset>3600</espi:dstOffset>
<espi:dstStartRule>360E2000</espi:dstStartRule>
<espi:tzOffset>-18000</espi:tzOffset>
</espi:LocalTimeParameters>
</content>
</entry>
...
</feed>
A rule value of <dstStartRule>FFFFFFFF</dstStartRule>
or <dstEndRule>FFFFFFFF</dstEndRule>
means rule processing/DST correction is disabled.
Another DST End Example:
In the European Union, DST currently starts on the last Sunday of March and ends on the last Sunday of October. The change is at 1:00 AM UTC (01:00), so it differs by time zones in Europe: e.g., 02:00 local time in Central Europe (CET) and 03:00 local time in Eastern Europe (EET).
Using Finland (EET) as an example of when DST ends: the rule is…
Month: 10 (“October”)
Operator: 7 (“the last occurrence of the Day of the Week in a month”)
Day of Month: 0 (“not applicable”)
Day of Week: 7 (“Sunday”)
Hours: 3 (“3:__”)
Seconds: 0 ( “__:00” or 00 minutes)
When | October | last occurrence | no certain date | Sunday | 3 AM | :00 after the hour |
Decimal | 10 | 7 | 0 | 7 | 3 | 0 |
Binary | 1010 |
111_ |
0 0000 |
111_ |
0 0011 |
0000 0000 0000 |
Hexadecimal | A | E0 | E3 | 000 |
Then, the hexadecimal is used in the dstEndRule …
<dstEndRule>AE0E3000</dstEndRule>
… to be placed into a <LocalTimeParameters>
element.
Time Zone Offset
The time-zone offset found in the LocalTimeParameters element is used by the Third Party to adjust the UTC date-time of each related timestamp. It allows the Third Party to correlate interval readings with local times of day for their clients.
tzOffset is an offset from Standard Time (not Daylight Savings Time) in a value of seconds; either positive or negative.
For example, in the North American Eastern Standard Time Zone, the offset from UTC is currently recognized by the USA to be −05:00 (or in US law as, the standard time of the first zone shall be Coordinated Universal Time retarded by 4 hours; that of the second zone retarded by 5 hours […]
1). Similarly, Ontario, Canada states this as, five hours behind Greenwich time.
2 Canada defines time-zone rules by province.
An example, therefore, of a −05:00 offset in the ESPI standard is …
<tzOffset>-18000</tzOffset>
Thus, if DST were active for a given interval (based on the parameters of the dstStartRule and dstEndRule), then the offset would be adjusted, by the Third Party receiving the data, by the number of seconds found in the dstOffset:
For example …
<dstOffset>3600</dstOffset>
and <tzOffset>-18000</tzOffset>
… would result in a DST time-zone offset of −14400 or in hours:minutes it would be −04:00 instead of −05:00 for the given interval(s) in the DST date range.