| 246 | |
| 247 | |
| 248 | time_t tz_adjust_ts(time_t unix_time, const str *tz) |
| 249 | { |
| 250 | struct tm local_tm; |
| 251 | time_t adj_ts; |
| 252 | |
| 253 | tz_set(_str("UTC")); |
| 254 | localtime_r(&unix_time, &local_tm ); |
| 255 | tz_reset(); |
| 256 | |
| 257 | if (tz) |
| 258 | tz_set(tz); |
| 259 | |
| 260 | adj_ts = mktime(&local_tm); |
| 261 | tz_reset(); |
| 262 | |
| 263 | if (local_tm.tm_isdst > 0) |
| 264 | adj_ts -= 3600; |
| 265 | |
| 266 | LM_DBG("UNIX ts: %ld, local-adjusted ts: %ld (tz: '%.*s', DST: %s)\n", |
| 267 | (long int)unix_time, (long int)adj_ts, tz ? tz->len : 4, |
| 268 | tz ? tz->s : "null", local_tm.tm_isdst == 1 ? "on" : |
| 269 | local_tm.tm_isdst == 0 ? "off" : "unavail"); |
| 270 | |
| 271 | return adj_ts; |
| 272 | } |
| 273 | |
| 274 | |
| 275 | static inline void ac_tm_set_time(ac_tm_p _atp, time_t _t) |