Signed-off-by: Francois Gouget <fgouget@xxxxxxxxxxxxxxx> --- server/reds-private.h | 2 -- server/reds.c | 6 ++---- server/utils.h | 5 +++++ 3 files changed, 7 insertions(+), 6 deletions(-) spice_get_monotonic_time_ms() will be used more widely in the next patch. It may also make sense to convert some reds_get_mm_time() calls to spice_get_monotonic_time_ms() (e.g. in sound.c) but I'm not sure for these so I'm leaving that for a future patch. An alternative would be to call g_get_monotonic_time() directly. and do without spice_get_monotonic_time_ms() since it's so simple, and lose the symmetry with spice_get_monotonic_time_ns(). diff --git a/server/reds-private.h b/server/reds-private.h index 790f61c..5afde30 100644 --- a/server/reds-private.h +++ b/server/reds-private.h @@ -18,8 +18,6 @@ #ifndef REDS_PRIVATE_H #define REDS_PRIVATE_H -#include <time.h> - #include <spice/protocol.h> #define MIGRATE_TIMEOUT (1000 * 10) /* 10sec */ diff --git a/server/reds.c b/server/reds.c index 75a7d95..31362ef 100644 --- a/server/reds.c +++ b/server/reds.c @@ -29,7 +29,6 @@ #include <arpa/inet.h> #include <netdb.h> #include <limits.h> -#include <time.h> #include <pthread.h> #include <sys/mman.h> #include <fcntl.h> @@ -69,6 +68,7 @@ #include "smartcard.h" #endif #include "reds-stream.h" +#include "utils.h" #include "reds-private.h" @@ -2882,9 +2882,7 @@ static void migrate_timeout(void *opaque) uint32_t reds_get_mm_time(void) { - struct timespec time_space; - clock_gettime(CLOCK_MONOTONIC, &time_space); - return time_space.tv_sec * 1000 + time_space.tv_nsec / 1000 / 1000; + return spice_get_monotonic_time_ms(); } void reds_enable_mm_time(void) diff --git a/server/utils.h b/server/utils.h index 7c94880..3aa5be0 100644 --- a/server/utils.h +++ b/server/utils.h @@ -59,6 +59,11 @@ static inline red_time_t spice_get_monotonic_time_ns(void) return (red_time_t) time.tv_sec * (1000 * 1000 * 1000) + time.tv_nsec; } +static inline red_time_t spice_get_monotonic_time_ms(void) +{ + return g_get_monotonic_time() / 1000; +} + int rgb32_data_has_alpha(int width, int height, size_t stride, uint8_t *data, int *all_set_out); -- 2.6.2 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel