diff options
author | Alex Brainman <alex.brainman@gmail.com> | 2010-06-29 22:29:09 -0700 |
---|---|---|
committer | Alex Brainman <alex.brainman@gmail.com> | 2010-06-29 22:29:09 -0700 |
commit | 6c0c9a8ea92f43e5267dc7f3701e0ac7a2fcf637 (patch) | |
tree | 6d01f6fd795bccbb26491e5a615301bc35ca53a7 /src/pkg/syscall/syscall_windows.go | |
parent | b2d16743ded54d0bc55714151d25a1a1a0bae355 (diff) | |
download | golang-6c0c9a8ea92f43e5267dc7f3701e0ac7a2fcf637.tar.gz |
time: implement timezones for windows
Fixes issue 761.
R=PeterGo, adg, rsc
CC=golang-dev
http://codereview.appspot.com/1121042
Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/pkg/syscall/syscall_windows.go')
-rw-r--r-- | src/pkg/syscall/syscall_windows.go | 16 |
1 files changed, 7 insertions, 9 deletions
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 |