diff options
author | Roger Dingledine <arma@torproject.org> | 2013-11-15 17:10:31 -0500 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2013-11-15 17:10:31 -0500 |
commit | 5d1a004e0dd0ef33f60985c47f86c255a3404a0f (patch) | |
tree | fe4c6e583b19670a69e5b3ea8ae213b802957182 /src/common/util.c | |
parent | f503f3043673e6eb550c722b74e57b49d4443ae7 (diff) | |
parent | 59f50c80d443a7e148f85cfed493e3e703cc4386 (diff) | |
download | tor-5d1a004e0dd0ef33f60985c47f86c255a3404a0f.tar.gz tor-5d1a004e0dd0ef33f60985c47f86c255a3404a0f.zip |
Merge branch 'maint-0.2.4' into release-0.2.4
Diffstat (limited to 'src/common/util.c')
-rw-r--r-- | src/common/util.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c index ae385e1b94..5eb0f9a69b 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -1232,6 +1232,18 @@ tv_mdiff(const struct timeval *start, const struct timeval *end) return mdiff; } +/** + * Converts timeval to milliseconds. + */ +int64_t +tv_to_msec(const struct timeval *tv) +{ + int64_t conv = ((int64_t)tv->tv_sec)*1000L; + /* Round ghetto-style */ + conv += ((int64_t)tv->tv_usec+500)/1000L; + return conv; +} + /** Yield true iff <b>y</b> is a leap-year. */ #define IS_LEAPYEAR(y) (!(y % 4) && ((y % 100) || !(y % 400))) /** Helper: Return the number of leap-days between Jan 1, y1 and Jan 1, y2. */ |