[asterisk-bugs] [Asterisk 0012374]: STRPTIME does not respect time dayligh saving time
noreply at bugs.digium.com
noreply at bugs.digium.com
Mon Apr 7 11:49:42 CDT 2008
A NOTE has been added to this issue.
======================================================================
http://bugs.digium.com/view.php?id=12374
======================================================================
Reported By: johan
Assigned To: Corydon76
======================================================================
Project: Asterisk
Issue ID: 12374
Category: Core-General
Reproducibility: always
Severity: major
Priority: normal
Status: assigned
Asterisk Version: 1.4.19
SVN Branch (only for SVN checkouts, not tarball releases): N/A
SVN Revision (number only!):
Disclaimer on File?: N/A
Request Review:
======================================================================
Date Submitted: 04-06-2008 20:27 CDT
Last Modified: 04-07-2008 11:49 CDT
======================================================================
Summary: STRPTIME does not respect time dayligh saving time
Description:
STRPTIME is an hour off because of daylight saving time.
This dialplan:
Set(datewithtz=${STRFTIME(${EPOCH},Europe/Stockholm,%Y-%m-%d
%H:%M:%S)});
Set(datenotz=${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)});
Noop(${STRPTIME(${datewithtz},GMT-2,%Y-%m-%d %H:%M:%S)});
Noop(${STRPTIME(${datewithtz},Europe/Stockholm,%Y-%m-%d %H:%M:%S)});
Noop(${EPOCH});
prints this:
Set("datewithtz=2008-04-07 03:22:08") in new stack
Set("datenotz=2008-04-07 03:22:08") in new stack
NoOp("1207531328") in new stack <--- this one is right (workaround)
NoOp("1207534928") in new stack <--- this one is wrong (should work)
NoOp("1207531328") in new stack <--- this is EPOCH.
As you see the result is off by an hour. STRFTIME works fine but STRPTIME
does not.
======================================================================
----------------------------------------------------------------------
DEA - 04-07-08 11:49
----------------------------------------------------------------------
The function strptime does not know about DST, but as it happens
the problem is actually with the call to ast_mktime.
By setting t.tm.tm_isdst to -1 before calling ast_mktime, the
ast_mktime will determine if DST rules are in effect.
This would be a one-liner fix in funcs/func_strings.c around
line 707.
Issue History
Date Modified Username Field Change
======================================================================
04-07-08 11:49 DEA Note Added: 0085083
======================================================================
More information about the asterisk-bugs
mailing list