[asterisk-users] CDR accuracy
Steve Murphy
murf at digium.com
Tue Aug 12 11:35:52 CDT 2008
On Tue, 2008-08-12 at 16:39 +0200, Klaus Darilion wrote:
> Hi!
>
> I wonder how Asterisk measures the call duration. The CDR files have a
> accuracy of seconds. Thus, what happens if the call duration is 0.3
> seconds. What will Asterisk report? 0 seconds? 1 second?
>
> What logic will be used by Asterisk: floor? ceil? round?
>
> thanks
> klaus
Klaus--
The duration/billsec fields are stored as simple integers.
A simple integer subtraction is performed for both; duration
is end time minus start time; billsec is end time minus answer time.
Operations are done on system time, in seconds. If the .3 sec spans
a system second increment, then the time will be 1, if not, then the
time will be 0. It would seem to me the probability of .3 sec spanning
a clock tick would be .3...
CDR's do, internally, store finer increments than seconds. (struct
timeval),
but the interface yields plain seconds. I just checked the code, and
sure enough, just the seconds field is used. So, truncation seems to be
the rounding method.
In general, we never fussed much about the microseconds, because on
most interfaces, the slop in how much time it took to make a connection
made the precision laughable.
murf
--
Steve Murphy
Software Developer
Digium
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3227 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20080812/84c97cd8/attachment.bin
More information about the asterisk-users
mailing list