I have a multi-threaded application which needs to display certain dates to the user. The dates are stored using UTC Unix time values. However, the date must be displayed in the time zone of the user, not the local server time or UTC. Basically, I need a function like this:
struct tm *usertime_r(const time_t *timer, struct tm *result, const int timezone) {
<just like localtime_r, except it uses UTC+timezone as the timezone>
}
This function must be thread safe, so I don't believe that setting the TZ
environment variable would be an option.