[tz] Regarding mktime issue

Paul Eggert eggert at cs.ucla.edu
Thu Mar 9 02:02:33 UTC 2017


On 03/07/2017 10:45 PM, Gopesh Kumar Chaudhary wrote:
> 1) In above mentioned scenario  does mktime has the intelligence to 
> decide whether above  mentioned time in tm structure is in DST or not 
> as dst flag is set to -1 ?

In the example you gave, mktime can return either a timestamp with 
tm_isdst==0, or a timestamp with tm_isdst>0. Both answers are correct, 
in the sense that the relevant standards allow mktime to return either 
answer. So the RHEL 7.2 mktime is operating correctly.

In general, the output of localtime is ambiguous, in the sense that two 
different timestamps can generate exactly the same struct tm values on 
some platforms, and POSIX allows this. An example of that is the 
repeated time 2014-10-26 01:30 when TZ="Europe/Moscow", which 
corresponds to both 1414276200 and to 1414279800 when considered as 
POSIX timestamps. This is because Moscow changed timezones from UT +04 
to +03 that morning.



More information about the tz mailing list