summaryrefslogtreecommitdiffstats
path: root/libgo/go/os/file_posix.go
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2011-12-13 19:16:27 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2011-12-13 19:16:27 +0000
commit43eb1b72e5730064410a2d81e3f8d78ab62776cb (patch)
treec5132538d5da85ed816c7e1f9d93c4a503b838ab /libgo/go/os/file_posix.go
parente27d80f7754f29f038c29ddcb2decd894d3e4aa4 (diff)
downloadppe42-gcc-43eb1b72e5730064410a2d81e3f8d78ab62776cb.tar.gz
ppe42-gcc-43eb1b72e5730064410a2d81e3f8d78ab62776cb.zip
libgo: Update to weekly.2011-12-02.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182295 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/os/file_posix.go')
-rw-r--r--libgo/go/os/file_posix.go16
1 files changed, 9 insertions, 7 deletions
diff --git a/libgo/go/os/file_posix.go b/libgo/go/os/file_posix.go
index c80d3df5e50..a4ab5d6ae25 100644
--- a/libgo/go/os/file_posix.go
+++ b/libgo/go/os/file_posix.go
@@ -8,6 +8,7 @@ package os
import (
"syscall"
+ "time"
)
func sigpipe() // implemented in package runtime
@@ -168,11 +169,11 @@ func (f *File) Truncate(size int64) error {
// Sync commits the current contents of the file to stable storage.
// Typically, this means flushing the file system's in-memory copy
// of recently written data to disk.
-func (file *File) Sync() (err error) {
- if file == nil {
+func (f *File) Sync() (err error) {
+ if f == nil {
return EINVAL
}
- if e := syscall.Fsync(file.fd); e != nil {
+ if e := syscall.Fsync(f.fd); e != nil {
return NewSyscallError("fsync", e)
}
return nil
@@ -181,11 +182,12 @@ func (file *File) Sync() (err error) {
// Chtimes changes the access and modification times of the named
// file, similar to the Unix utime() or utimes() functions.
//
-// The argument times are in nanoseconds, although the underlying
-// filesystem may truncate or round the values to a more
-// coarse time unit.
-func Chtimes(name string, atime_ns int64, mtime_ns int64) error {
+// The underlying filesystem may truncate or round the values to a
+// less precise time unit.
+func Chtimes(name string, atime time.Time, mtime time.Time) error {
var utimes [2]syscall.Timeval
+ atime_ns := atime.Unix()*1e9 + int64(atime.Nanosecond())
+ mtime_ns := mtime.Unix()*1e9 + int64(mtime.Nanosecond())
utimes[0] = syscall.NsecToTimeval(atime_ns)
utimes[1] = syscall.NsecToTimeval(mtime_ns)
if e := syscall.Utimes(name, utimes[0:]); e != nil {
OpenPOWER on IntegriCloud