From 6c0c9a8ea92f43e5267dc7f3701e0ac7a2fcf637 Mon Sep 17 00:00:00 2001 From: Alex Brainman Date: Tue, 29 Jun 2010 22:29:09 -0700 Subject: time: implement timezones for windows Fixes issue 761. R=PeterGo, adg, rsc CC=golang-dev http://codereview.appspot.com/1121042 Committer: Russ Cox --- src/pkg/syscall/syscall_windows.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/pkg/syscall/syscall_windows.go') diff --git a/src/pkg/syscall/syscall_windows.go b/src/pkg/syscall/syscall_windows.go index 2f0552b6a..8b6789221 100644 --- a/src/pkg/syscall/syscall_windows.go +++ b/src/pkg/syscall/syscall_windows.go @@ -127,20 +127,13 @@ func getSysProcAddr(m uint32, pname string) uintptr { //sys GetComputerName(buf *uint16, n *uint32) (ok bool, errno int) = GetComputerNameW //sys SetEndOfFile(handle int32) (ok bool, errno int) //sys GetSystemTimeAsFileTime(time *Filetime) -//sys sleep(msec uint32) = Sleep +//sys sleep(msec uint32) = Sleep +//sys GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, errno int) [failretval=0xffffffff] //sys CreateIoCompletionPort(filehandle int32, cphandle int32, key uint32, threadcnt uint32) (handle int32, errno int) //sys GetQueuedCompletionStatus(cphandle int32, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (ok bool, errno int) // syscall interface implementation for other packages -func Sleep(nsec int64) (errno int) { - nsec += 999999 // round up to milliseconds - msec := uint32(nsec / 1e6) - sleep(msec) - errno = 0 - return -} - func Errstr(errno int) string { if errno == EWINDOWS { return "not supported by windows" @@ -379,6 +372,11 @@ func Gettimeofday(tv *Timeval) (errno int) { return 0 } +func Sleep(nsec int64) (errno int) { + sleep(uint32((nsec + 1e6 - 1) / 1e6)) // round up to milliseconds + return 0 +} + // TODO(brainman): implement Utimes, or rewrite os.file.Chtimes() instead func Utimes(path string, tv []Timeval) (errno int) { return EWINDOWS -- cgit v1.2.3