[asterisk-users] Mysql 6 second rounding
Steve Edwards
asterisk.org at sedwards.com
Mon Nov 13 14:55:18 MST 2006
On Tue, 14 Nov 2006, Vicky wrote:
> This is more of mysql question then asterisk :D . Most voip providers use 6
> second rounding for costing . My asterisk server stores call cdr's in mysql
> properly with billsec field containing number of billed seconds . I want to
> know some function to round this to 6 seconds ( or any custom valud like 30
> seconds ) ..Suppose if billsec field is 3 seconds then it should round to 6
> seconds , if its 13 second then it should round up to 18 seconds ( for 6sec
> pulse counting ) . What would be mysql function to do this ?
mysql> select floor(((3 + 5) / 6)) * 6;
+--------------------------+
| floor(((3 + 5) / 6)) * 6 |
+--------------------------+
| 6 |
+--------------------------+
1 row in set (0.00 sec)
mysql> select floor(((13 + 5) / 6)) * 6;
+---------------------------+
| floor(((13 + 5) / 6)) * 6 |
+---------------------------+
| 18 |
+---------------------------+
1 row in set (0.00 sec)
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