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
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- AstriCon 2008 - September 22 - 25 Phoenix, Arizona Register Now: http://www.astricon.net asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users