[Development] How does mktime() handle DST transitions ?

Welbourne Edward edward.welbourne at theqtcompany.com
Tue Nov 3 15:28:13 CET 2015

Hi all,

I'm looking into QTBUG-49008 and need to work out how diverse
implementations of mktime handle DST transitions: at one end of the year
there's a gap (where 1:59 is followed by 3:00), at the other end there's
a duplicated hour (where 2:59 is followed by a reprise of 2:00 in
Europe, or 1:59 by 1:00 in the USA, IIUC).  While we still need to work
out what behaviour *we* want to give, implementing it is going to depend
on knowing what the platform mktime gives us to work with.

I know glibc's behaviour (2.19-22), although confirmation of it from
elsewhere and version variation may be worth knowing.  We have a kludge
for MS-Win that suggests what it does (actually quite sensible, though
different to GNU), but I'd be glad of confirmation.  The 'net suggests
FreeBSD may even treat some of it as errors; I may need to follow up on
that, and on Mac.  So I wrote a simple test program.

If you're willing to compile and run the attached simple C program,
please let me know its output and your platform's details - ideally
off-list - I'll give a summary in a few days' time.  Those not in Europe
shall need to amend the data in two statics at the top of the file
(there are comments to guide you) to hit when your DST transitions are.
(I'd also be glad to know what those are, if you include a diff.)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mktime.c
Type: text/x-csrc
Size: 1978 bytes
Desc: mktime.c
URL: <http://lists.qt-project.org/pipermail/development/attachments/20151103/e3863723/attachment.c>

More information about the Development mailing list