summaryrefslogtreecommitdiff
path: root/lib/util/tests
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-12-23 22:10:34 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-12-23 22:10:34 +0100
commitef80d1b794a209ee446c7a586530a5fdd51175f2 (patch)
tree9c368f4a0d281ca1ba48e575fc25638d59dc27ef /lib/util/tests
parentd0eeb9aa8db42ed1fc18024614560820354e6dfa (diff)
downloadsamba-ef80d1b794a209ee446c7a586530a5fdd51175f2.tar.gz
samba-ef80d1b794a209ee446c7a586530a5fdd51175f2.tar.bz2
samba-ef80d1b794a209ee446c7a586530a5fdd51175f2.zip
Fix use of "time offset" parameter, and add test to make sure I don't break it again :-)
Diffstat (limited to 'lib/util/tests')
-rw-r--r--lib/util/tests/time.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/util/tests/time.c b/lib/util/tests/time.c
index 4a31566b42..e24c5fe5ef 100644
--- a/lib/util/tests/time.c
+++ b/lib/util/tests/time.c
@@ -58,6 +58,21 @@ static bool test_timestring(struct torture_context *tctx)
return true;
}
+static bool test_get_time_zone(struct torture_context *tctx)
+{
+ time_t t = time(NULL);
+ int old_extra_time_offset = extra_time_offset;
+ int old_offset, new_offset;
+ /* test that extra_time_offset works */
+
+ old_offset = get_time_zone(t);
+ extra_time_offset = 42;
+ new_offset = get_time_zone(t);
+ extra_time_offset = old_extra_time_offset;
+ torture_assert_int_equal(tctx, old_offset+60*42, new_offset,
+ "time offset not used");
+ return true;
+}
struct torture_suite *torture_local_util_time(TALLOC_CTX *mem_ctx)
@@ -65,6 +80,7 @@ struct torture_suite *torture_local_util_time(TALLOC_CTX *mem_ctx)
struct torture_suite *suite = torture_suite_create(mem_ctx, "TIME");
torture_suite_add_simple_test(suite, "null_time", test_null_time);
+ torture_suite_add_simple_test(suite, "get_time_zone", test_get_time_zone);
torture_suite_add_simple_test(suite, "null_nttime", test_null_nttime);
torture_suite_add_simple_test(suite, "http_timestring",
test_http_timestring);