提交 8951d26f authored 作者: Brian West's avatar Brian West

FS-6626 fix winter DST issue

上级 ba067f32
......@@ -1637,16 +1637,16 @@ SWITCH_DECLARE(switch_status_t) switch_find_interface_ip(char *buf, int len, int
SWITCH_DECLARE(switch_time_t) switch_str_time(const char *in)
{
switch_time_exp_t tm = { 0 };
switch_time_exp_t tm = { 0 }, local_tm = { 0 };
int proceed = 0, ovector[30];
switch_regex_t *re = NULL;
char replace[1024] = "";
switch_time_t ret = 0;
switch_time_t ret = 0, local_time = 0;
char *pattern = "^(\\d+)-(\\d+)-(\\d+)\\s*(\\d*):{0,1}(\\d*):{0,1}(\\d*)";
char *pattern2 = "^(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})";
switch_time_exp_lt(&tm, switch_micro_time_now());
tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = tm.tm_usec = 0;
if (!(proceed = switch_regex_perform(in, pattern, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
switch_regex_safe_free(re);
......@@ -1687,6 +1687,11 @@ SWITCH_DECLARE(switch_time_t) switch_str_time(const char *in)
switch_regex_safe_free(re);
switch_time_exp_get(&local_time, &tm);
switch_time_exp_lt(&local_tm, local_time);
tm.tm_isdst = local_tm.tm_isdst;
tm.tm_gmtoff = local_tm.tm_gmtoff;
switch_time_exp_gmt_get(&ret, &tm);
return ret;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论