[asterisk-users] STRFTIME dialplan function not picking up system timezone

Hadley Rich asterisk at nice.net.nz
Wed Aug 16 15:58:03 MST 2006


On Wednesday 16 August 2006 10:18, Hadley Rich wrote:
> I've just been playing with the STRFTIME dialplan function and am having
> trouble getting it to pickup my systems local timezone.
>
> According to show function STRFTIME and voip-info.org all the arguments are
> optional and according to voip-info.org if you leave them out they will
> default to the current time, the current timezone and %c respectively.
>
> My local timezone is Pacific/Auckland (GMT+12) which is setup correctly
> AFAIK - date returns the correct time and timezone. I have also tried
> setting TZ=Pacific/Auckland and running asterisk at that console which
> didn't alter the behaviour.
>
> If I call a test extension with this in the dialplan;
>
> NoOp(${STRFTIME(,,)}))
> NoOp(${STRFTIME(,Pacific/Auckland,)}))
>
> then I get this output (shortened) ;
>
> NoOp("SIP/800-081778a4", "Tue Aug 15 22:11:36 2006)")
> NoOp("SIP/800-081778a4", "Wed Aug 16 10:11:36 2006)")
>
> I have also tried reading asterisk/stdtime/localtime.c which is (I think)
> where this stuff goes on but it's over my head.
>
> Does anyone have any ideas as to why I can't get this to work or am I
> expecting the wrong behaviour (using SVN trunk)?

After further playing it's not just STRFTIME. Voicemail and other things such 
as SayUnixTime are showing GMT time although cdrs (using cdr-csv) and 
Asterisk logs show the correct time.

From looking at the code it appears that logs and cdrs use localtime_r 
directly whereas the dialplan functions use stdtime/localtime in the Asterisk 
source. Although as I said, that's a bit above me in terms of C.

Anyone have any ideas?

hads

-- 
http://nicegear.co.nz
New Zealand's VoIP supplier



More information about the asterisk-users mailing list