summaryrefslogtreecommitdiff
path: root/wsutil
diff options
context:
space:
mode:
authorMartin Mathieson <martin.r.mathieson@googlemail.com>2017-05-03 22:56:55 +0100
committerAnders Broman <a.broman58@gmail.com>2017-05-04 03:45:07 +0000
commit8638eb91c78cd773b59636bc40642a0ae0e55409 (patch)
treece81df757f5798852edb3ab2513c3daf76d3f60d /wsutil
parent0d5c98c4a6ee08faa8a747d631ab12db5e714e6e (diff)
downloadwireshark-8638eb91c78cd773b59636bc40642a0ae0e55409.tar.gz
Add g_get_monotonic_time() to glib-compat and use
Change-Id: If41dab19692516270e8b4bcf1a8a954bb8dc3ccc Reviewed-on: https://code.wireshark.org/review/21480 Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'wsutil')
-rw-r--r--wsutil/glib-compat.c14
-rw-r--r--wsutil/glib-compat.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/wsutil/glib-compat.c b/wsutil/glib-compat.c
index 5d3cec8374..8acc520b49 100644
--- a/wsutil/glib-compat.c
+++ b/wsutil/glib-compat.c
@@ -62,6 +62,20 @@ g_list_free_full(GList *list,
g_list_free(list);
}
+/**
+* g_get_monotonic_time:
+*
+* Queries the system monotonic time. Returns value in microseconds.
+*
+* Since: 2.28
+*/
+gint64 g_get_monotonic_time (void)
+{
+ GTimeVal result;
+ g_get_current_time(&result);
+ return result.tv_sec*1000000 + result.tv_usec;
+}
+
#endif
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
diff --git a/wsutil/glib-compat.h b/wsutil/glib-compat.h
index 378a020b0d..adaa630f8e 100644
--- a/wsutil/glib-compat.h
+++ b/wsutil/glib-compat.h
@@ -27,6 +27,7 @@
#if !GLIB_CHECK_VERSION(2, 28, 0)
WS_DLL_PUBLIC void g_slist_free_full(GSList *list, GDestroyNotify free_func);
WS_DLL_PUBLIC void g_list_free_full(GList *list, GDestroyNotify free_func);
+WS_DLL_PUBLIC gint64 g_get_monotonic_time (void);
#endif
#endif /* GLIB_COMPAT_H */