March 9, 2017
10:10 p.m.
On 03/09/2017 03:37 AM, Gopesh Kumar Chaudhary wrote:
Is it expected behavior of mktime to give non DST epoch for both DST and non DST time stamp ?
If you give mktime a valid struct tm whose tm_isdst value is positive and mktime returns successfully, the resulting tm_isdst should also be positive. Likewise for when tm_isdst is zero. The test case you supplied, however, had a negative tm_isdst, and this told mktime that you didn't know whether the timestamp used DST and that it was OK for mktime to assume either DST or non-DST. In cases where multiple valid answers could be returned, the standard does not specify which answer is "correct". So GNU mktime is operating correctly here.