Restoring DST under Linux in C

I have date / time information from Berlin, Germany. For example: 2011-05-16 12:24:23, 2011-01-21 17:00:31

Unfortunately, during these times there is no information about daylight saving time. I know that the first date is CEST and the second is CET.

I could write a check whether the date / time is summer or not.

Daylight saving time begins on the last Sunday in March at 2:00 and ends on the last Sunday in October at 3 a.m.

The self-development of such a check seems to be a mistake prone to me. Is there something that can be used on Linux in C?

Thank you for your help.

+5
source share
2 answers

time_t mktime(), localtime(), tm_isdst. mktime() localtime() , , DST , . , timestamp , .

+2

%Z date , , DST :

$ date -d '2011-05-16' '+%Z'
CEST

$ date -d '2011-01-21' '+%Z'
CET
+1

All Articles