Add time_update().

This commit is contained in:
Cameron Evans
2016-02-02 21:52:08 -08:00
committed by Jason Evans
parent f829009929
commit e5d5a4a517
7 changed files with 97 additions and 2 deletions

23
test/unit/time.c Normal file
View File

@@ -0,0 +1,23 @@
#include "test/jemalloc_test.h"
TEST_BEGIN(test_time_update)
{
struct timespec ts;
memset(&ts, 0, sizeof(struct timespec));
assert_false(time_update(&ts), "Basic time update failed.");
/* Only Rip Van Winkle sleeps this long. */
ts.tv_sec += 631152000;
assert_true(time_update(&ts), "Update should detect time roll-back.");
}
TEST_END
int
main(void)
{
return (test(
test_time_update));
}