Linux kernel provides time_to_tm()
(see here):
/**
* time_to_tm - converts the calendar time to local broken-down time
*
* @totalsecs the number of seconds elapsed since 00:00:00 on January 1, 1970,
* Coordinated Universal Time (UTC).
* @offset offset seconds adding to totalsecs.
* @result pointer to struct tm variable to receive broken-down time
*/
void time_to_tm(time_t totalsecs, int offset, struct tm *result)
According to description, tm
will be local broken-down time.
Thus I understand tm
will respect my local time zone and DST.
If this correct, I don't see it in the code.
Maybe argument offset
should be used to "provide" local time zone and DST?
UPDATE
Following this question, thus using sys_tz in conjunction with time_to_tm()
we can get "true" local time?
AFAIK, localtime notation belongs to userland. For example DST is defined in specially compiled configuration files per time zone.
I'm confused. What is the meaning of sys_tz
in kernel than?