Re: [asterisk-users] Time variables in system application
Hi Guys, for people who may have the same issue: i was just not using STRFTIME the right way, after consulting docs, i'm using it like this: exten = ,n,Set(FAXFILENOEXT=/var/spool/asterisk/fax/${STRFTIME(${EPOCH},America/New_York,%F_%T)}) instead of this: exten = ,n,Set(FAXFILENOEXT=/var/spool/asterisk/fax/${STRFTIME(${EPOCH},GMT-5,%F_%T)}) and it's displaying the right time now!! 2010/4/13 Danny Nicholas da...@debsinc.com My derailed train of thought came from OP's mention of Centos 5.3 - I have to do a hwclock -s on my 5.3 box at least daily to keep a reasonable time. -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Tilghman Lesher Sent: Tuesday, April 13, 2010 2:58 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] Time variables in system application On Tuesday 13 April 2010 14:00:36 Danny Nicholas wrote: Just what I thought - guess that's the X'th time I wuz wrong today. The only difference between what I think you're calling the system time (output of date) and Asterisk is that Asterisk uses a different (internal) library to convert the epoch-based time into a broken-out date. Both are using exactly the same value internally, however. Hardware clock is generally how system time is set initially at boot, though with NTP servers and system skew, it's possible for the two values to drift apart over time. -- Tilghman Lesher Digium, Inc. | Senior Software Developer twitter: Corydon76 | IRC: Corydon76-dig (Freenode) Check us out at: www.digium.com www.asterisk.org -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- Abdullah -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Time variables in system application
khalid touati wrote: Hi Guys, for people who may have the same issue: i was just not using STRFTIME the right way, after consulting docs, i'm using it like this: exten = ,n,Set(FAXFILENOEXT=/var/spool/asterisk/fax/${STRFTIME(${EPOCH},America/New_York,%F_%T)}) instead of this: exten = ,n,Set(FAXFILENOEXT=/var/spool/asterisk/fax/${STRFTIME(${EPOCH},GMT-5,%F_%T)}) and it's displaying the right time now!! You might need to put America/New_York in quotes -- 'America/New_York' or America/New_York. This based on my experience with the Perl DateTime module. Of course YMMV and you have it working now. :-) \\||/ Rod -- 2010/4/13 Danny Nicholas da...@debsinc.com mailto:da...@debsinc.com My derailed train of thought came from OP's mention of Centos 5.3 - I have to do a hwclock -s on my 5.3 box at least daily to keep a reasonable time. -Original Message- From: asterisk-users-boun...@lists.digium.com mailto:asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Tilghman Lesher Sent: Tuesday, April 13, 2010 2:58 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] Time variables in system application On Tuesday 13 April 2010 14:00:36 Danny Nicholas wrote: Just what I thought - guess that's the X'th time I wuz wrong today. The only difference between what I think you're calling the system time (output of date) and Asterisk is that Asterisk uses a different (internal) library to convert the epoch-based time into a broken-out date. Both are using exactly the same value internally, however. Hardware clock is generally how system time is set initially at boot, though with NTP servers and system skew, it's possible for the two values to drift apart over time. -- Tilghman Lesher Digium, Inc. | Senior Software Developer twitter: Corydon76 | IRC: Corydon76-dig (Freenode) Check us out at: www.digium.com http://www.digium.com www.asterisk.org http://www.asterisk.org -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- Abdullah -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Time variables in system application
thanks i'll keep that in mind. 2010/6/2 Roderick A. Anderson raand...@cyber-office.net khalid touati wrote: Hi Guys, for people who may have the same issue: i was just not using STRFTIME the right way, after consulting docs, i'm using it like this: exten = ,n,Set(FAXFILENOEXT=/var/spool/asterisk/fax/${STRFTIME(${EPOCH},America/New_York,%F_%T)}) instead of this: exten = ,n,Set(FAXFILENOEXT=/var/spool/asterisk/fax/${STRFTIME(${EPOCH},GMT-5,%F_%T)}) and it's displaying the right time now!! You might need to put America/New_York in quotes -- 'America/New_York' or America/New_York. This based on my experience with the Perl DateTime module. Of course YMMV and you have it working now. :-) \\||/ Rod -- 2010/4/13 Danny Nicholas da...@debsinc.com mailto:da...@debsinc.com My derailed train of thought came from OP's mention of Centos 5.3 - I have to do a hwclock -s on my 5.3 box at least daily to keep a reasonable time. -Original Message- From: asterisk-users-boun...@lists.digium.com mailto:asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Tilghman Lesher Sent: Tuesday, April 13, 2010 2:58 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] Time variables in system application On Tuesday 13 April 2010 14:00:36 Danny Nicholas wrote: Just what I thought - guess that's the X'th time I wuz wrong today. The only difference between what I think you're calling the system time (output of date) and Asterisk is that Asterisk uses a different (internal) library to convert the epoch-based time into a broken-out date. Both are using exactly the same value internally, however. Hardware clock is generally how system time is set initially at boot, though with NTP servers and system skew, it's possible for the two values to drift apart over time. -- Tilghman Lesher Digium, Inc. | Senior Software Developer twitter: Corydon76 | IRC: Corydon76-dig (Freenode) Check us out at: www.digium.com http://www.digium.com www.asterisk.org http://www.asterisk.org -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com-- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com-- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- Abdullah -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- Abdullah -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Time variables in system application
On Wed, Jun 02, 2010 at 10:26:12AM -0400, khalid touati wrote: Hi Guys, for people who may have the same issue: i was just not using STRFTIME the right way, after consulting docs, i'm using it like this: exten = ,n,Set(FAXFILENOEXT=/var/spool/asterisk/fax/${STRFTIME(${EPOCH},America/New_York,%F_%T)}) instead of this: exten = ,n,Set(FAXFILENOEXT=/var/spool/asterisk/fax/${STRFTIME(${EPOCH},GMT-5,%F_%T)}) and it's displaying the right time now!! If all you want is your system's idea of the current local time, you can simplify it to: exten = ,n,Set(FAXFILENOEXT=/var/spool/asterisk/fax/${STRFTIME(,,%F_%T)}) Sorry for replying so late. I somehow missed this thread back in April. -- Barry -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Time variables in system application
thank you Barry, you're right, it is also working. well, happy that i have a bunch of choices that work (after wrong output). thanks for all! 2010/6/2 Barry Miller asterisk-us...@notanet.net On Wed, Jun 02, 2010 at 10:26:12AM -0400, khalid touati wrote: Hi Guys, for people who may have the same issue: i was just not using STRFTIME the right way, after consulting docs, i'm using it like this: exten = ,n,Set(FAXFILENOEXT=/var/spool/asterisk/fax/${STRFTIME(${EPOCH},America/New_York,%F_%T)}) instead of this: exten = ,n,Set(FAXFILENOEXT=/var/spool/asterisk/fax/${STRFTIME(${EPOCH},GMT-5,%F_%T)}) and it's displaying the right time now!! If all you want is your system's idea of the current local time, you can simplify it to: exten = ,n,Set(FAXFILENOEXT=/var/spool/asterisk/fax/${STRFTIME(,,%F_%T)}) Sorry for replying so late. I somehow missed this thread back in April. -- Barry -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- Abdullah -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Time variables in system application
You are apparently in U.S. Central Time zone.Asterisk uses the hardware clock and system() uses the system clock, so these are probably out of sync. Try doing Date and Hwclock From a command prompt. _ From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of khalid touati Sent: Tuesday, April 13, 2010 1:08 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: [asterisk-users] Time variables in system application Hi Guys, i have a weird thing here: when using time variables (%F %T) in a shell script, out of dial plan (particularly system() app); it displays the right time (same as output of date), but when same variables are used in system() application it displays a wrong time/date (ahead of 6 hours). I am using a centos 5.3, can anyone help me fix this? -- Abdullah -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Time variables in system application
You are apparently in U.S. Central Time zone.Asterisk uses the hardware clock and system() uses the system clock, so these are probably out of sync. Try doing Date and Hwclock From a command prompt. thanks, here is the output of the two clocks you mentioned they dispaly same info (slight diff on in 24 and other 12 format)!! if any body know what's the issue, i will be grateful! [r...@pbx1 bin]# hwclock Tue 13 Apr 2010 02:40:16 PM EDT -0.000607 seconds [r...@pbx1 bin]# date Tue Apr 13 14:41:11 EDT 2010 -- *From:* asterisk-users-boun...@lists.digium.com [mailto: asterisk-users-boun...@lists.digium.com] *On Behalf Of *khalid touati *Sent:* Tuesday, April 13, 2010 1:08 PM *To:* Asterisk Users Mailing List - Non-Commercial Discussion *Subject:* [asterisk-users] Time variables in system application Hi Guys, i have a weird thing here: when using time variables (%F %T) in a shell script, out of dial plan (particularly system() app); it displays the right time (same as output of date), but when same variables are used in system() application it displays a wrong time/date (ahead of 6 hours). I am using a centos 5.3, can anyone help me fix this? -- Abdullah -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- Abdullah -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Time variables in system application
On Tuesday 13 April 2010 13:27:30 Danny Nicholas wrote: You are apparently in U.S. Central Time zone.Asterisk uses the hardware clock What makes you think Asterisk uses the hardware clock? -- Tilghman Lesher Digium, Inc. | Senior Software Developer twitter: Corydon76 | IRC: Corydon76-dig (Freenode) Check us out at: www.digium.com www.asterisk.org -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Time variables in system application
Just what I thought - guess that's the X'th time I wuz wrong today. -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Tilghman Lesher Sent: Tuesday, April 13, 2010 1:58 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] Time variables in system application On Tuesday 13 April 2010 13:27:30 Danny Nicholas wrote: You are apparently in U.S. Central Time zone.Asterisk uses the hardware clock What makes you think Asterisk uses the hardware clock? -- Tilghman Lesher Digium, Inc. | Senior Software Developer twitter: Corydon76 | IRC: Corydon76-dig (Freenode) Check us out at: www.digium.com www.asterisk.org -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Time variables in system application
At least on this forum, bad help usually leads to good help??? _ From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of khalid touati Sent: Tuesday, April 13, 2010 2:37 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] Time variables in system application i believe not only today :D, but thank u anyway for the spirit of helping people!! 2010/4/13 Danny Nicholas da...@debsinc.com Just what I thought - guess that's the X'th time I wuz wrong today. -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Tilghman Lesher Sent: Tuesday, April 13, 2010 1:58 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] Time variables in system application On Tuesday 13 April 2010 13:27:30 Danny Nicholas wrote: You are apparently in U.S. Central Time zone.Asterisk uses the hardware clock What makes you think Asterisk uses the hardware clock? -- Tilghman Lesher Digium, Inc. | Senior Software Developer twitter: Corydon76 | IRC: Corydon76-dig (Freenode) Check us out at: www.digium.com www.asterisk.org -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- Abdullah -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Time variables in system application
i believe not only today :D, but thank u anyway for the spirit of helping people!! 2010/4/13 Danny Nicholas da...@debsinc.com Just what I thought - guess that's the X'th time I wuz wrong today. -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Tilghman Lesher Sent: Tuesday, April 13, 2010 1:58 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] Time variables in system application On Tuesday 13 April 2010 13:27:30 Danny Nicholas wrote: You are apparently in U.S. Central Time zone.Asterisk uses the hardware clock What makes you think Asterisk uses the hardware clock? -- Tilghman Lesher Digium, Inc. | Senior Software Developer twitter: Corydon76 | IRC: Corydon76-dig (Freenode) Check us out at: www.digium.com www.asterisk.org -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- Abdullah -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Time variables in system application
On Tuesday 13 April 2010 14:00:36 Danny Nicholas wrote: Just what I thought - guess that's the X'th time I wuz wrong today. The only difference between what I think you're calling the system time (output of date) and Asterisk is that Asterisk uses a different (internal) library to convert the epoch-based time into a broken-out date. Both are using exactly the same value internally, however. Hardware clock is generally how system time is set initially at boot, though with NTP servers and system skew, it's possible for the two values to drift apart over time. -- Tilghman Lesher Digium, Inc. | Senior Software Developer twitter: Corydon76 | IRC: Corydon76-dig (Freenode) Check us out at: www.digium.com www.asterisk.org -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] Time variables in system application
My derailed train of thought came from OP's mention of Centos 5.3 - I have to do a hwclock -s on my 5.3 box at least daily to keep a reasonable time. -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Tilghman Lesher Sent: Tuesday, April 13, 2010 2:58 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] Time variables in system application On Tuesday 13 April 2010 14:00:36 Danny Nicholas wrote: Just what I thought - guess that's the X'th time I wuz wrong today. The only difference between what I think you're calling the system time (output of date) and Asterisk is that Asterisk uses a different (internal) library to convert the epoch-based time into a broken-out date. Both are using exactly the same value internally, however. Hardware clock is generally how system time is set initially at boot, though with NTP servers and system skew, it's possible for the two values to drift apart over time. -- Tilghman Lesher Digium, Inc. | Senior Software Developer twitter: Corydon76 | IRC: Corydon76-dig (Freenode) Check us out at: www.digium.com www.asterisk.org -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users