summaryrefslogtreecommitdiff
path: root/include/asterisk/time.h
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2005-06-24 22:50:07 +0000
committerKevin P. Fleming <kpfleming@digium.com>2005-06-24 22:50:07 +0000
commitb83175862e4557b5b3ffae80e54fa9b852ad79e2 (patch)
tree50a9a4abdd0dbc7c6cc8e80129c958a9f3581290 /include/asterisk/time.h
parent3e44b65090f3f2b5b3e0c1e8e11bf34a1b01afc8 (diff)
add new header files
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6009 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk/time.h')
-rwxr-xr-xinclude/asterisk/time.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/asterisk/time.h b/include/asterisk/time.h
new file mode 100755
index 000000000..a92e1f91e
--- /dev/null
+++ b/include/asterisk/time.h
@@ -0,0 +1,35 @@
+/*
+ * Asterisk -- A telephony toolkit for Linux.
+ *
+ * Time-related functions and macros
+ *
+ * Copyright (C) 2004 - 2005, Digium, Inc.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License
+ */
+
+#ifndef _ASTERISK_TIME_H
+#define _ASTERISK_TIME_H
+
+#include <sys/time.h>
+
+/*!
+ * \brief Computes the difference (in milliseconds) between two \c struct \c timeval instances.
+ * \param start the beginning of the time period
+ * \param end the end of the time period
+ * \return the difference in milliseconds
+ */
+int ast_tvdiff_ms(const struct timeval *start, const struct timeval *end);
+#if !defined(LOW_MEMORY) && !defined(AST_API_MODULE)
+extern inline
+#endif
+#if !defined(LOW_MEMORY) || defined(AST_API_MODULE)
+int ast_tvdiff_ms(const struct timeval *start, const struct timeval *end)
+{
+ return ((end->tv_sec - start->tv_sec) * 1000) + ((end->tv_usec - start->tv_usec) / 1000);
+}
+#endif
+
+#undef AST_API_MODULE
+#endif /* _ASTERISK_TIME_H */