[asterisk-users] Time difference in CSV CDR's and MySQL CDR's

Steve Edwards asterisk.org at sedwards.com
Thu Apr 22 08:44:25 CDT 2010


Un-top-posting...

> 2010/4/22 Alejandro Recarey <alexrecarey at gmail.com>:
>>
>> I am having a curious problem. I use two cdr backends, csv and MySQL.
>>
>> I am finding that the calldate field varies between 3 seconds and 3 
>> minutes between the MySQL database and the CSV files! Is this expected 
>> behaviour? I thought they should both use the same timestamp.

On Thu, 22 Apr 2010, Zhang Shukun wrote:

> the time in the file cdr is right, as mysql. calldate is the time when 
> the record insert into mysql.

I'm just a 1.2 Luddite, but...

In cdr_addon_mysql.c:

         localtime_r(&cdr->start.tv_sec,&tm);
         strftime(timestr,128,DATE_FORMAT,&tm);

and then timestr is used to populate the 'calldate' column when the insert 
statement is built.

Which is consistent with my CDRs -- they show the time the call was 
started, not some time after the call is finished when the row is inserted 
into the database.

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000



More information about the asterisk-users mailing list