From a99d14d1939cb2338b6268d9aebe3850df66daed Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Sun, 13 Dec 2015 15:43:46 +0100 Subject: Improved congestion control handling Refine the previous method by interpolating the values we need. This reduces the effect of the problem that we cannot send enough ping packets. --- common/rfb/util.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'common/rfb/util.h') diff --git a/common/rfb/util.h b/common/rfb/util.h index e9114c3d..3ca92f9d 100644 --- a/common/rfb/util.h +++ b/common/rfb/util.h @@ -95,9 +95,17 @@ namespace rfb { return (secs < 0 || secs > (INT_MAX/1000) ? INT_MAX : secs * 1000); } + // Returns time elapsed between two moments in milliseconds. + unsigned msBetween(const struct timeval *first, + const struct timeval *second); + // Returns time elapsed since given moment in milliseconds. unsigned msSince(const struct timeval *then); + // Returns true if first happened before seconds + bool isBefore(const struct timeval *first, + const struct timeval *second); + size_t siPrefix(long long value, const char *unit, char *buffer, size_t maxlen, int precision=6); size_t iecPrefix(long long value, const char *unit, -- cgit v1.2.3