| 1 | import time |
| 2 | |
| 3 | fn test_tm_gmtoff() { |
| 4 | $if windows { |
| 5 | return |
| 6 | } $else { |
| 7 | rawtime := i64(0) // C.time_t{} |
| 8 | |
| 9 | C.time(&rawtime) // C.tm{} |
| 10 | |
| 11 | info := C.localtime(&rawtime) |
| 12 | t1 := time.now() |
| 13 | t2 := time.utc() |
| 14 | dump(t1) |
| 15 | dump(t2) |
| 16 | dump(t1.nanosecond) |
| 17 | dump(t2.nanosecond) |
| 18 | diff := int(t1.local_unix() - t2.unix()) |
| 19 | dump(diff) |
| 20 | dump(info.tm_gmtoff) |
| 21 | assert diff in [info.tm_gmtoff - 1, info.tm_gmtoff, info.tm_gmtoff + 1] |
| 22 | } |
| 23 | } |
| 24 |