diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-04-10 10:47:11 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-04-13 10:41:08 -0400 |
commit | d8ef9a2d1e0701073d8209115bc3c34857c2d7b4 (patch) | |
tree | fd7439b0c9d3d743e9fcde67ae5ebc5ad785381f /src/test | |
parent | 16f08de0fd85b9fe8ace9f4905190fa6dc27e4ea (diff) | |
download | tor-d8ef9a2d1e0701073d8209115bc3c34857c2d7b4.tar.gz tor-d8ef9a2d1e0701073d8209115bc3c34857c2d7b4.zip |
Expose a function that computes stamp units from msec.
(It turns out we can't just expose STAMP_TICKS_PER_SECOND, since
Apple doesn't have that.)
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test_util.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c index ce8567d9af..3dd2b51a3a 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -5907,6 +5907,13 @@ test_util_monotonic_time(void *arg) tt_u64_op(coarse_stamp_diff, OP_GE, 120); tt_u64_op(coarse_stamp_diff, OP_LE, 1200); + { + uint64_t units = monotime_msec_to_approx_coarse_stamp_units(5000); + uint64_t ms = monotime_coarse_stamp_units_to_approx_msec(units); + tt_int_op(ms, OP_GE, 4950); + tt_int_op(ms, OP_LT, 5050); + } + done: ; } |