[Freeswitch-dev] Epoch current time difference

Anthony Minessale anthony.minessale at gmail.com
Sat Sep 10 00:19:19 MSD 2011


Most likely you are using something like ntp to sync your system
clock, if so you should also sync the FS clock when you change the ntp
time.

FS is keeping it's own time using the monotonic clock in the kernel
which is the same mechanism as the system time so your machine
probably keeps bad time.


On Fri, Sep 9, 2011 at 8:27 AM, Glaucio Vaz de Mello <gvmello at yx.cl> wrote:
> Hi,
>
> Thanks for the answer.
> I made several tests and came to the conclusion that FreeSWITCH clock is
> always avanced compared to system time. The difference is about 9 seconds
> per day, just letting FreeSWITCH running, without touching the system clock.
> Effectively I can sync with system time with "fsctl sync_clock", then the
> difference comes to zero and start counting again.
>
> This can be an issue for billing long duration calls, since the registered
> call duration will be some seconds more than it really was.
> If someone need more information, logs or reporting this issue as a bug,
> just let me know.
>
>
> regards,
> Glaucio
>
>
>
> On Tue, Sep 6, 2011 at 1:57 AM, lakshmanan ganapathy <lakindia89 at gmail.com>
> wrote:
>>
>> As for as I know, FreeSWITCH maintains its own clock. When you start
>> freeswitch for the first time, it takes the system time and from there on,
>> it uses its own clock to update the time. So After starting freeswitch, if
>> you change the system time, then freeswitch time and system time will be
>> different.
>>
>> You can sync the system time by using "fsctl sync_clock". Check whether
>> the 9 seconds it due to this behaviour....
>>
>>
>> On Wed, Aug 31, 2011 at 7:26 PM, Glaucio Vaz de Mello <gvmello at yx.cl>
>> wrote:
>>>
>>> Hello,
>>>
>>>    I noticed a difference between FreeSWITCH time and system clock time.
>>>    Is this a standard behaviour? or something is wrong in my system?
>>>
>>> More details of the issue:
>>>    Inside FreeSWITCH I look for current epoch time using this function:
>>> time_t now = switch_epoch_time_now(NULL);
>>>
>>>    Then I look for system clock current time using:
>>> #include <time.h>
>>> time_t now = time(NULL);
>>>
>>>    Between both results I noticed a difference of 9 seconds.
>>>
>>>
>>> This can also be viewed using Unix commands.
>>>
>>> Unix date command from console:
>>> # date +%s
>>> 1314741992
>>>
>>> Then, I start a call and make a DB query:
>>> # sqlite3 /var/freeswitch/db/core.db "SELECT call_created_epoch FROM
>>> calls;"
>>> 1314742000
>>>
>>> Then I repeat unix date command:
>>> # date +%s
>>> 1314741994
>>>
>>> Any comments are welcome.
>>> Regards,
>>> Glaucio
>>>
>>> _______________________________________________
>>> Join us at ClueCon 2011, Aug 9-11, Chicago
>>> http://www.cluecon.com 877-7-4ACLUE
>>>
>>> FreeSWITCH-dev mailing list
>>> FreeSWITCH-dev at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>>> http://www.freeswitch.org
>>>
>>
>>
>> _______________________________________________
>> Join us at ClueCon 2011, Aug 9-11, Chicago
>> http://www.cluecon.com 877-7-4ACLUE
>>
>> FreeSWITCH-dev mailing list
>> FreeSWITCH-dev at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>> http://www.freeswitch.org
>>
>
>
> _______________________________________________
> Join us at ClueCon 2011, Aug 9-11, Chicago
> http://www.cluecon.com 877-7-4ACLUE
>
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>
>



-- 
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale at hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org
googletalk:conf+888 at conference.freeswitch.org
pstn:+19193869900



Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-dev mailing list