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)
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);
return seconds;
}
+
+int extra_time_offset=0;
+
/**
return the UTC offset in seconds west of UTC, or 0 if it cannot be determined
*/
tm = localtime(&t);
if (!tm)
return 0;
- return tm_diff(&tm_utc,tm);
+ return tm_diff(&tm_utc,tm)+60*extra_time_offset;
}
struct timespec nt_time_to_unix_timespec(NTTIME *nt)
bool null_timespec(struct timespec ts);
+/** Extra minutes to add to the normal GMT to local time conversion. */
+extern int extra_time_offset;
+
#endif /* _SAMBA_TIME_H_ */
return (time_t)u;
}
-int extra_time_offset=0;
-
/****************************************************************************
Check if NTTIME is 0.
****************************************************************************/
#define USERSHARE_VALID 1
#define USERSHARE_PENDING_DELETE 2
-extern int extra_time_offset;
-
static bool defaults_saved = False;
struct param_opt_struct {