Подробности
[В начало]
Проблема в стандарте № S0561
Краткое описание
Неоднозначность в интерпретации влияния поля tm_isdst на обработку %z в strftime()
Подробное описание
В стандарте POSIX-2008 о спецификаторе %z функции strftime() говорится следующее:
Replaced by the offset from UTC in the ISO 8601:2000 standard format ( +hhmm or -hhmm ), or by no characters if no timezone is determinable. For example, "-0430" means 4 hours 30 minutes behind UTC (west of Greenwich). If tm_isdst is zero, the standard time offset is used. If tm_isdst is greater than zero, the daylight savings time offset is used. If tm_isdst is negative, no characters are returned.
Но как указал Carlos O`Donell:
There are two ways to interpret the wording in POSIX and what is stored in
`struct tm`
Either:
(a) If tm_isdst is >0 then the values already stored in the broken down time
had daylight savings applied.
or
(b) If tm_isdst is >0 then the values in the broken down time shall be adjusted
by daylight savings when printed. That is to say that the values in the broken
down time must *always* be the non-DST version of those values, with strftime
applying the adjustment at the time of printing.
The POSIX wording doesn`t say what happens if you change the tm_isdst field,
only that if it is >0 the DST-adjusted offset will be used, and if it is 0 the
non-DST offset will be used.
The most logical and simplest implementation is that the the time in the broken
down time is always the local time with DST applied, and if DST was applied
then tm_isdst is >0 (ignoring tm_isdst <0 which is handled correctly).
The GNU C Library follows interpretation (a).
The LSB testsuite appears to follow interpretation (b).
Так как под текущую интерпретацию glibc написано множество программ, было принято решение исправить тесты.
Раздел стандарта
Linux Standard Base Core Specification 3.1, Chapter 13. Base Libraries, 13.5. Interface Definitions for libc, description of strftime() function.
Принято
Статус
reported
[В начало]