How to convert from UTC to local time in C?

If you can assume POSIX (and thus the POSIX specification of time_t as seconds since the epoch), I would first use the POSIX formula to convert to seconds since the epoch: tm_sec + tm_min*60 + tm_hour*3600 + tm_yday*86400 + (tm_year-70)*31536000 + ((tm_year-69)/4)*86400 – ((tm_year-1)/100)*86400 + ((tm_year+299)/400)*86400 Next, use localtime((time_t []){0}) to get a struct tm … Read more