summaryrefslogtreecommitdiff
path: root/main/strcompat.c
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2010-09-24 03:41:02 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2010-09-24 03:41:02 +0000
commitf8180257e040e68b36ea87959598b55e46c15919 (patch)
tree307f62f875675a52717fd0ad060a0a0bca34f4ea /main/strcompat.c
parentcfe811bb358ecc9e07ba42a0508453862592e5cc (diff)
Merged revisions 288638 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r288638 | tilghman | 2010-09-23 22:39:29 -0500 (Thu, 23 Sep 2010) | 16 lines Merged revisions 288637 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ................ r288637 | tilghman | 2010-09-23 22:36:01 -0500 (Thu, 23 Sep 2010) | 9 lines Merged revisions 288636 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r288636 | tilghman | 2010-09-23 22:20:24 -0500 (Thu, 23 Sep 2010) | 2 lines Solaris compatibility fixes ........ ................ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@288639 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/strcompat.c')
-rw-r--r--main/strcompat.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/main/strcompat.c b/main/strcompat.c
index 923e935f7..831ab0ce9 100644
--- a/main/strcompat.c
+++ b/main/strcompat.c
@@ -169,6 +169,19 @@ int vasprintf(char **strp, const char *fmt, va_list ap)
}
#endif /* !defined(HAVE_VASPRINTF) && !defined(__AST_DEBUG_MALLOC) */
+#ifndef HAVE_TIMERSUB
+void timersub(struct timeval *tvend, struct timeval *tvstart, struct timeval *tvdiff)
+{
+ tvdiff->tv_sec = tvend->tv_sec - tvstart->tv_sec;
+ tvdiff->tv_usec = tvend->tv_usec - tvstart->tv_usec;
+ if (tvdiff->tv_usec < 0) {
+ tvdiff->tv_sec --;
+ tvdiff->tv_usec += 1000000;
+ }
+
+}
+#endif
+
/*
* Based on Code from bsd-asprintf from OpenSSH
* Copyright (c) 2004 Darren Tucker.