I am processing stored dates and times. I store them in a file in GMT in a string format
(i.e. DDMMYYYYHHMMSS
). When a client queries, I convert this string to a struct tm
, then convert it to seconds using mktime
. I do this to check for invalid DateTime. Again I do convert seconds to string format. All these processing is fine, no issues at all.
But I have one weird issue: I stored the date and time in GMT with locale also GMT. Because of day light saving, my locale time changed to GMT+1. Now, if I query the stored date and time I get 1 hour less because the mktime
function uses locale, i.e. GMT+1, to convert the struct tm
to seconds (tm_isdst
set to -1 so mktime
detects daylight savings etc. automatically).
Any ideas how to solve this issue?