summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/device.c10
-rw-r--r--src/utils.c14
-rw-r--r--src/utils.h2
3 files changed, 16 insertions, 10 deletions
diff --git a/src/device.c b/src/device.c
index ef97f72..e36509e 100644
--- a/src/device.c
+++ b/src/device.c
@@ -120,16 +120,6 @@ struct mux_device
static struct collection device_list;
pthread_mutex_t device_list_mutex;
-static uint64_t mstime64(void)
-{
- struct timeval tv;
- gettimeofday(&tv, NULL);
-
- // Careful, avoid overflow on 32 bit systems
- // time_t could be 4 bytes
- return ((long long)tv.tv_sec) * 1000LL + ((long long)tv.tv_usec) / 1000LL;
-}
-
static struct mux_device* get_mux_device_for_id(int device_id)
{
struct mux_device *dev = NULL;
diff --git a/src/utils.c b/src/utils.c
index 9fa4d80..4218758 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
+#include <sys/time.h>
#include "utils.h"
@@ -272,3 +273,16 @@ int plist_write_to_filename(plist_t plist, const char *filename, enum plist_form
return 1;
}
+
+/**
+ * Get number of milliseconds since the epoch.
+ */
+uint64_t mstime64(void)
+{
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+
+ // Careful, avoid overflow on 32 bit systems
+ // time_t could be 4 bytes
+ return ((long long)tv.tv_sec) * 1000LL + ((long long)tv.tv_usec) / 1000LL;
+}
diff --git a/src/utils.h b/src/utils.h
index 67477b5..92a7d68 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -87,4 +87,6 @@ enum plist_format_t {
int plist_read_from_filename(plist_t *plist, const char *filename);
int plist_write_to_filename(plist_t plist, const char *filename, enum plist_format_t format);
+uint64_t mstime64(void);
+
#endif