Summary: | ASTERISK-10787: [patch] ast_tvdiff_us | ||
Reporter: | Dmitry Andrianov (dimas) | Labels: | |
Date Opened: | 2007-11-16 07:08:28.000-0600 | Date Closed: | 2007-12-19 13:26:22.000-0600 |
Priority: | Trivial | Regression? | No |
Status: | Closed/Complete | Components: | General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) tvdiff_us.patch ( 1) tvdiff_us-2.patch ( 2) tvdiff_us-3.patch ( 3) tvdiff_us-4.patch | |
Description: | Patch adds trivial function ast_tvdiff_us to get the difference between two timeval instances in microseconds. ****** ADDITIONAL INFORMATION ****** We need this one for T38 fax terminal support in ReceiveFAX (issue 10815). Although the fax application is in addons, I believe it worth having this function in the core asterisk (close to its friend ast_tvdiff_ms which returns milliseconds) | ||
Comments: | By: Dmitry Andrianov (dimas) 2007-11-16 08:00:57.000-0600 sorry, first patch contains typo. I fixed it in second one. By: Tilghman Lesher (tilghman) 2007-11-16 15:19:14.000-0600 Is there a reason why you chose int64_t as the return type, though your calculations are not necessarily done in that precision? By: Dmitry Andrianov (dimas) 2007-11-17 08:41:52.000-0600 My bad. This is result of extensive usage of Java where long is 64 bit... I chosen 64 bits intentionally because time delta expressed in microseconds can be very big value and 32 bit signed int can only represent about 30 minutes. Obviously, where we need microsecond precision, we are measuring very small intervals so even 32 bit int is ok. But I just didn't want surprise someone who could use this function for long intervals. I can fix the patch in both ways but I would prefer "true" 64 bits. What do you think? By: Tilghman Lesher (tilghman) 2007-11-17 09:34:17.000-0600 Sure, that's fine. By: Dmitry Andrianov (dimas) 2007-11-17 13:04:12.000-0600 Fixed. The new patch also adds ast_tvdiff_sec to get delta in seconds. By: Tilghman Lesher (tilghman) 2007-12-14 09:42:07.000-0600 One last thing. The documentation in your patch suggests that the start is the end and end is the beginning, which is really confusing. Could you correct the documentation, please? By: Dmitry Andrianov (dimas) 2007-12-14 10:16:07.000-0600 Ohh. I've just took the documentation from already existing ast_tvdiff_ms. So it seems this function needs to be fixed too. Will upload new patch in 10 minutes... By: Digium Subversion (svnbot) 2007-12-19 13:26:21.000-0600 Repository: asterisk Revision: 94029 U trunk/include/asterisk/time.h ------------------------------------------------------------------------ r94029 | russell | 2007-12-19 13:26:20 -0600 (Wed, 19 Dec 2007) | 7 lines Add a couple of new time API calls - ast_tvdiff_sec and ast_tvdiff_usec (closes issue ASTERISK-10787) Reported by: dimas Patches: tvdiff_us-4.patch uploaded by dimas (license 88) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=94029 |