Merged revisions 113117 via svnmerge from
authorTilghman Lesher <tilghman@meg.abyt.es>
Mon, 7 Apr 2008 19:06:46 +0000 (19:06 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Mon, 7 Apr 2008 19:06:46 +0000 (19:06 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r113117 | tilghman | 2008-04-07 12:51:49 -0500 (Mon, 07 Apr 2008) | 3 lines

Force ast_mktime() to check for DST, since strptime(3) does not.
(Closes issue #12374)

........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@113172 65c4cc65-6c06-0410-ace0-fbb531ad65f3

funcs/func_strings.c

index 45d476e..f50ea24 100644 (file)
@@ -704,7 +704,10 @@ static int acf_strptime(struct ast_channel *chan, const char *cmd, char *data,
        if (!strptime(args.timestring, args.format, &t.time)) {
                ast_log(LOG_WARNING, "C function strptime() output nothing?!!\n");
        } else {
-               struct timeval tv = ast_mktime(&t.atm, args.timezone);
+               struct timeval tv;
+               /* Since strptime(3) does not check DST, force ast_mktime() to calculate it. */
+               t.atm.tm_isdst = -1;
+               tv = ast_mktime(&t.atm, args.timezone);
                snprintf(buf, len, "%d", (int) tv.tv_sec);
        }