MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / tz_adjust_ts

Function tz_adjust_ts

time_rec.c:248–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246
247
248time_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
275static inline void ac_tm_set_time(ac_tm_p _atp, time_t _t)

Callers

nothing calls this directly

Calls 3

tz_setFunction · 0.85
_strClass · 0.85
tz_resetFunction · 0.85

Tested by

no test coverage detected