` proc unixTimeMs(): int = when defined(windows): let cmd = """powershell -nologo -noprofile -command "[DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds()"""" else: let cmd = """sh -c "echo $(date +%s)000"""" let (output, code) = gorgeEx(cmd) if code == 0: return output.strip().parseInt else: raise newException(OSError, "Failed to get unix time: " & output) `
Run