github.com/llvm-mirror/llgo@v0.0.0-20190322182713-bf6f0a60fce1/third_party/gofrontend/libgo/go/syscall/libcall_posix_utimesnano.go (about) 1 // Copyright 2012 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // General POSIX version of UtimesNano. 6 7 package syscall 8 9 import "unsafe" 10 11 func UtimesNano(path string, ts []Timespec) error { 12 // TODO: The BSDs can do utimensat with SYS_UTIMENSAT but it 13 // isn't supported by darwin so this uses utimes instead 14 if len(ts) != 2 { 15 return EINVAL 16 } 17 // Not as efficient as it could be because Timespec and 18 // Timeval have different types in the different OSes 19 tv := [2]Timeval{ 20 NsecToTimeval(TimespecToNsec(ts[0])), 21 NsecToTimeval(TimespecToNsec(ts[1])), 22 } 23 return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) 24 }