Module: sip-router
Branch: 3.2
Commit: 406ecb7c981a37e789402990dbdfd7eaf1157cec
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=406ecb7…
Author: Timo Reimann <sr(a)foo-lounge.de>
Committer: Timo Reimann <sr(a)foo-lounge.de>
Date: Sat Nov 5 02:41:19 2011 +0100
acc(k): Define timersub macro for Solaris as it is not provided in
<sys/time.h>.
(cherry picked from commit 456903d2b4775e3d968e2eaa08b46e64993f4053)
---
modules_k/acc/acc_cdr.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/modules_k/acc/acc_cdr.c b/modules_k/acc/acc_cdr.c
index 88d4a22..a3760b9 100644
--- a/modules_k/acc/acc_cdr.c
+++ b/modules_k/acc/acc_cdr.c
@@ -46,6 +46,19 @@
#include <sys/time.h>
+/* Solaris does not provide timersub macro in <sys/time.h> */
+#ifdef __OS_solaris
+#define timersub(tvp, uvp, vvp) \
+ do { \
+ (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
+ (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
+ if ((vvp)->tv_usec < 0) { \
+ (vvp)->tv_sec--; \
+ (vvp)->tv_usec += 1000000; \
+ } \
+ } while (0)
+#endif // __OS_solaris
+
#define TIME_STR_BUFFER_SIZE 20
#define TIME_BUFFER_LENGTH 256