1 The `gmtime()` function returns the given epoch timestamp (or now, 2 if omitted) as a dictionary containing broken-down date and time 3 information interpreted as UTC time. 4 5 -- Testcase -- 6 {% 7 let t = time(); 8 let d1 = gmtime(); 9 let d2 = gmtime(1647953502); 10 11 // assert that localtime without epoch returns the current time 12 let c = timegm(d1); 13 assert(c >= t && c <= t + 5, "gmtime() result does not match time()"); 14 15 // dump fixed time and check expected output 16 printf("%.J\n", d2); 17 %} 18 -- End -- 19 20 -- Expect stdout -- 21 { 22 "sec": 42, 23 "min": 51, 24 "hour": 12, 25 "mday": 22, 26 "mon": 3, 27 "year": 2022, 28 "wday": 2, 29 "yday": 81, 30 "isdst": 0 31 } 32 -- End --
This page was automatically generated by LXR 0.3.1. • OpenWrt