summaryrefslogtreecommitdiffhomepage
path: root/tests/custom/03_stdlib/20_time
blob: 173ae094943c2e0aa7daeeffee338f610f4973e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
The `time()` function returns the current UNIX epoch time.


-- Testcase --
{%
	let timestamp = time();
	let testcmd = sprintf('t=$(date +%%s); [ $t -gt %d -a $t -lt %d ]', timestamp - 3, timestamp + 3);

	if (system(testcmd) == 0)
		print("time() works\n");
	else
		print("time() and `date +%s` yield different results!\n");
%}
-- End --

-- Expect stdout --
time() works
-- End --