The semantic change makes it difficult for the fix tool to update automatically.
</p>
-<h3 id="os_fileinfo">The os.FileInfo type</h3>
+<h3 id="os">The os package</h3>
+
+<p>The <code>Time</code> function has been removed; callers should use
+the <a href="/pkg/time/#Time"><code>Time</code></a> type from the
+<code>time</code> package.</p>
+
+<p>
+<em>Updating</em>:
+Code that uses <code>os.Time</code> will fail to compile and must be updated by hand.
+</p>
+
+<h4 id="os_fileinfo">The os.FileInfo type</h4>
<p>
Go 1 redefines the <a href="/pkg/os/#FileInfo"><code>os.FileInfo</code></a> type,
The semantic change makes it difficult for the fix tool to update automatically.
</p>
-<h3 id="os_fileinfo">The os.FileInfo type</h3>
+<h3 id="os">The os package</h3>
+
+<p>The <code>Time</code> function has been removed; callers should use
+the <a href="/pkg/time/#Time"><code>Time</code></a> type from the
+<code>time</code> package.</p>
+
+<p>
+<em>Updating</em>:
+Code that uses <code>os.Time</code> will fail to compile and must be updated by hand.
+</p>
+
+<h4 id="os_fileinfo">The os.FileInfo type</h4>
<p>
Go 1 redefines the <a href="/pkg/os/#FileInfo"><code>os.FileInfo</code></a> type,
"error.go",
"file.go",
"os_test.go",
- "time.go",
"types.go",
"stat_darwin.go",
"stat_linux.go",
fd.Close()
}
-func TestTime(t *testing.T) {
- // Just want to check that Time() is getting something.
- // A common failure mode on Darwin is to get 0, 0,
- // because it returns the time in registers instead of
- // filling in the structure passed to the system call.
- // Too bad the compiler doesn't know that
- // 365.24*86400 is an integer.
- sec, nsec, err := Time()
- if sec < (2009-1970)*36524*864 {
- t.Errorf("Time() = %d, %d, %s; not plausible", sec, nsec, err)
- }
-}
-
func TestSeek(t *testing.T) {
f := newFile("TestSeek", t)
defer Remove(f.Name())
+++ /dev/null
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package os
-
-import "syscall"
-
-// Time returns the current time, in whole seconds and
-// fractional nanoseconds, plus an error if any. The current
-// time is thus 1e9*sec+nsec, in nanoseconds. The zero of
-// time is the Unix epoch.
-func Time() (sec int64, nsec int64, err error) {
- var tv syscall.Timeval
- if e := syscall.Gettimeofday(&tv); e != nil {
- return 0, 0, NewSyscallError("gettimeofday", e)
- }
- return int64(tv.Sec), int64(tv.Usec) * 1000, err
-}