diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-12-03 02:17:34 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-12-03 02:17:34 +0000 |
commit | 2fd401c8f190f1fe43e51a7f726f6ed6119a1f96 (patch) | |
tree | 7f76eff391f37fe6467ff4ffbc0c582c9959ea30 /libgo/go/time | |
parent | 02e9018f1616b23f1276151797216717b3564202 (diff) | |
download | gcc-2fd401c8f190f1fe43e51a7f726f6ed6119a1f96.zip gcc-2fd401c8f190f1fe43e51a7f726f6ed6119a1f96.tar.gz gcc-2fd401c8f190f1fe43e51a7f726f6ed6119a1f96.tar.bz2 |
libgo: Update to weekly.2011-11-02.
From-SVN: r181964
Diffstat (limited to 'libgo/go/time')
-rw-r--r-- | libgo/go/time/format.go | 18 | ||||
-rw-r--r-- | libgo/go/time/sleep_test.go | 6 | ||||
-rw-r--r-- | libgo/go/time/sys.go | 4 | ||||
-rw-r--r-- | libgo/go/time/sys_plan9.go | 2 | ||||
-rw-r--r-- | libgo/go/time/sys_unix.go | 2 | ||||
-rw-r--r-- | libgo/go/time/sys_windows.go | 2 | ||||
-rw-r--r-- | libgo/go/time/tick.go | 4 | ||||
-rw-r--r-- | libgo/go/time/time_test.go | 2 | ||||
-rw-r--r-- | libgo/go/time/zoneinfo_windows.go | 2 |
9 files changed, 21 insertions, 21 deletions
diff --git a/libgo/go/time/format.go b/libgo/go/time/format.go index 1a629c9..14b712a 100644 --- a/libgo/go/time/format.go +++ b/libgo/go/time/format.go @@ -2,7 +2,7 @@ package time import ( "bytes" - "os" + "errors" "strconv" ) @@ -250,7 +250,7 @@ func match(s1, s2 string) bool { return true } -func lookup(tab []string, val string) (int, string, os.Error) { +func lookup(tab []string, val string) (int, string, error) { for i, v := range tab { if len(val) >= len(v) && match(val[0:len(v)], v) { return i, val[len(v):], nil @@ -413,7 +413,7 @@ func (t *Time) String() string { return t.Format(UnixDate) } -var errBad = os.NewError("bad value for field") // placeholder not passed to user +var errBad = errors.New("bad value for field") // placeholder not passed to user // ParseError describes a problem parsing a time string. type ParseError struct { @@ -425,7 +425,7 @@ type ParseError struct { } // String is the string representation of a ParseError. -func (e *ParseError) String() string { +func (e *ParseError) Error() string { if e.Message == "" { return "parsing time " + strconv.Quote(e.Value) + " as " + @@ -450,7 +450,7 @@ func isDigit(s string, i int) bool { // getnum parses s[0:1] or s[0:2] (fixed forces the latter) // as a decimal integer and returns the integer and the // remainder of the string. -func getnum(s string, fixed bool) (int, string, os.Error) { +func getnum(s string, fixed bool) (int, string, error) { if !isDigit(s, 0) { return 0, s, errBad } @@ -472,7 +472,7 @@ func cutspace(s string) string { // skip removes the given prefix from value, // treating runs of space characters as equivalent. -func skip(value, prefix string) (string, os.Error) { +func skip(value, prefix string) (string, error) { for len(prefix) > 0 { if prefix[0] == ' ' { if len(value) > 0 && value[0] != ' ' { @@ -505,7 +505,7 @@ func skip(value, prefix string) (string, os.Error) { // sane: hours in 0..23, minutes in 0..59, day of month in 1..31, etc. // Years must be in the range 0000..9999. The day of the week is checked // for syntax but it is otherwise ignored. -func Parse(alayout, avalue string) (*Time, os.Error) { +func Parse(alayout, avalue string) (*Time, error) { var t Time rangeErrString := "" // set if a value is out of range amSet := false // do we need to subtract 12 from the hour for midnight? @@ -513,7 +513,7 @@ func Parse(alayout, avalue string) (*Time, os.Error) { layout, value := alayout, avalue // Each iteration processes one std value. for { - var err os.Error + var err error prefix, std, suffix := nextStdChunk(layout) value, err = skip(value, prefix) if err != nil { @@ -730,7 +730,7 @@ func Parse(alayout, avalue string) (*Time, os.Error) { return &t, nil } -func (t *Time) parseNanoseconds(value string, nbytes int) (rangErrString string, err os.Error) { +func (t *Time) parseNanoseconds(value string, nbytes int) (rangErrString string, err error) { if value[0] != '.' { return "", errBad } diff --git a/libgo/go/time/sleep_test.go b/libgo/go/time/sleep_test.go index 9d16c52..2407a4a 100644 --- a/libgo/go/time/sleep_test.go +++ b/libgo/go/time/sleep_test.go @@ -5,8 +5,8 @@ package time_test import ( + "errors" "fmt" - "os" "testing" "sort" . "time" @@ -136,7 +136,7 @@ func TestAfterQueuing(t *testing.T) { // This test flakes out on some systems, // so we'll try it a few times before declaring it a failure. const attempts = 3 - err := os.NewError("!=nil") + err := errors.New("!=nil") for i := 0; i < attempts && err != nil; i++ { if err = testAfterQueuing(t); err != nil { t.Logf("attempt %v failed: %v", i, err) @@ -159,7 +159,7 @@ func await(slot int, result chan<- afterResult, ac <-chan int64) { result <- afterResult{slot, <-ac} } -func testAfterQueuing(t *testing.T) os.Error { +func testAfterQueuing(t *testing.T) error { const ( Delta = 100 * 1e6 ) diff --git a/libgo/go/time/sys.go b/libgo/go/time/sys.go index 9fde3b3..4bc9253 100644 --- a/libgo/go/time/sys.go +++ b/libgo/go/time/sys.go @@ -29,7 +29,7 @@ func Nanoseconds() int64 { // Sleep pauses the current goroutine for at least ns nanoseconds. // Higher resolution sleeping may be provided by syscall.Nanosleep // on some operating systems. -func Sleep(ns int64) os.Error { +func Sleep(ns int64) error { _, err := sleep(Nanoseconds(), ns) return err } @@ -37,7 +37,7 @@ func Sleep(ns int64) os.Error { // sleep takes the current time and a duration, // pauses for at least ns nanoseconds, and // returns the current time and an error. -func sleep(t, ns int64) (int64, os.Error) { +func sleep(t, ns int64) (int64, error) { // TODO(cw): use monotonic-time once it's available end := t + ns for t < end { diff --git a/libgo/go/time/sys_plan9.go b/libgo/go/time/sys_plan9.go index 9ae0161..a630b3e 100644 --- a/libgo/go/time/sys_plan9.go +++ b/libgo/go/time/sys_plan9.go @@ -9,7 +9,7 @@ import ( "syscall" ) -func sysSleep(t int64) os.Error { +func sysSleep(t int64) error { err := syscall.Sleep(t) if err != nil { return os.NewSyscallError("sleep", err) diff --git a/libgo/go/time/sys_unix.go b/libgo/go/time/sys_unix.go index 0119bdf..17a6a2d 100644 --- a/libgo/go/time/sys_unix.go +++ b/libgo/go/time/sys_unix.go @@ -11,7 +11,7 @@ import ( "syscall" ) -func sysSleep(t int64) os.Error { +func sysSleep(t int64) error { errno := syscall.Sleep(t) if errno != 0 && errno != syscall.EINTR { return os.NewSyscallError("sleep", errno) diff --git a/libgo/go/time/sys_windows.go b/libgo/go/time/sys_windows.go index feff90b..f9d6e89 100644 --- a/libgo/go/time/sys_windows.go +++ b/libgo/go/time/sys_windows.go @@ -9,7 +9,7 @@ import ( "syscall" ) -func sysSleep(t int64) os.Error { +func sysSleep(t int64) error { errno := syscall.Sleep(t) if errno != 0 && errno != syscall.EINTR { return os.NewSyscallError("sleep", errno) diff --git a/libgo/go/time/tick.go b/libgo/go/time/tick.go index 852bae9..92f9eb8 100644 --- a/libgo/go/time/tick.go +++ b/libgo/go/time/tick.go @@ -5,7 +5,7 @@ package time import ( - "os" + "errors" "sync" ) @@ -160,7 +160,7 @@ var onceStartTickerLoop sync.Once // ns must be greater than zero; if not, NewTicker will panic. func NewTicker(ns int64) *Ticker { if ns <= 0 { - panic(os.NewError("non-positive interval for NewTicker")) + panic(errors.New("non-positive interval for NewTicker")) } c := make(chan int64, 1) // See comment on send in tickerLoop t := &Ticker{ diff --git a/libgo/go/time/time_test.go b/libgo/go/time/time_test.go index e4cf513..8b373a1 100644 --- a/libgo/go/time/time_test.go +++ b/libgo/go/time/time_test.go @@ -387,7 +387,7 @@ func TestParseErrors(t *testing.T) { _, err := Parse(test.format, test.value) if err == nil { t.Errorf("expected error for %q %q", test.format, test.value) - } else if strings.Index(err.String(), test.expect) < 0 { + } else if strings.Index(err.Error(), test.expect) < 0 { t.Errorf("expected error with %q for %q %q; got %s", test.expect, test.format, test.value, err) } } diff --git a/libgo/go/time/zoneinfo_windows.go b/libgo/go/time/zoneinfo_windows.go index 41c4819..ba9295c 100644 --- a/libgo/go/time/zoneinfo_windows.go +++ b/libgo/go/time/zoneinfo_windows.go @@ -156,7 +156,7 @@ func (zi *zoneinfo) pickZone(t *Time) *zone { } var tz zoneinfo -var initError os.Error +var initError error var onceSetupZone sync.Once func setupZone() { |