diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-03-06 17:57:23 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-03-06 17:57:23 +0000 |
commit | 593f74bbab63d34c7060918088bcbad686c31c66 (patch) | |
tree | 4ce83ca433796a728e9fdd00af105bce158532b5 /libgo/go/time | |
parent | 46402cbe0ba3ea92be9642cf18eedaefe57a414c (diff) | |
download | gcc-593f74bbab63d34c7060918088bcbad686c31c66.zip gcc-593f74bbab63d34c7060918088bcbad686c31c66.tar.gz gcc-593f74bbab63d34c7060918088bcbad686c31c66.tar.bz2 |
libgo: Update to weekly.2012-03-04 release.
From-SVN: r185010
Diffstat (limited to 'libgo/go/time')
-rw-r--r-- | libgo/go/time/format.go | 8 | ||||
-rw-r--r-- | libgo/go/time/sleep_test.go | 7 | ||||
-rw-r--r-- | libgo/go/time/time.go | 15 |
3 files changed, 15 insertions, 15 deletions
diff --git a/libgo/go/time/format.go b/libgo/go/time/format.go index ef6f1f3..ad52bab 100644 --- a/libgo/go/time/format.go +++ b/libgo/go/time/format.go @@ -6,14 +6,6 @@ package time import "errors" -const ( - numeric = iota - alphabetic - separator - plus - minus -) - // These are predefined layouts for use in Time.Format. // The standard time used in the layouts is: // Mon Jan 2 15:04:05 MST 2006 diff --git a/libgo/go/time/sleep_test.go b/libgo/go/time/sleep_test.go index e572b67..440d3b4 100644 --- a/libgo/go/time/sleep_test.go +++ b/libgo/go/time/sleep_test.go @@ -120,8 +120,11 @@ func TestAfterTick(t *testing.T) { t1 := Now() d := t1.Sub(t0) target := Delta * Count - if d < target*9/10 || d > target*30/10 { - t.Fatalf("%d ticks of %s took %s, expected %s", Count, Delta, d, target) + if d < target*9/10 { + t.Fatalf("%d ticks of %s too fast: took %s, expected %s", Count, Delta, d, target) + } + if !testing.Short() && d > target*30/10 { + t.Fatalf("%d ticks of %s too slow: took %s, expected %s", Count, Delta, d, target) } } diff --git a/libgo/go/time/time.go b/libgo/go/time/time.go index 709a422..f7ded24 100644 --- a/libgo/go/time/time.go +++ b/libgo/go/time/time.go @@ -152,7 +152,7 @@ func (d Weekday) String() string { return days[d] } // rely heavily on division and modulus by positive constants. For // calendrical calculations we want these divisions to round down, even // for negative values, so that the remainder is always positive, but -// Go's division (like most hardware divison instructions) rounds to +// Go's division (like most hardware division instructions) rounds to // zero. We can still do those computations and then adjust the result // for a negative numerator, but it's annoying to write the adjustment // over and over. Instead, we can change to a different epoch so long @@ -384,6 +384,15 @@ type Duration int64 // Common durations. There is no definition for units of Day or larger // to avoid confusion across daylight savings time zone transitions. +// +// To count the number of units in a Duration, divide: +// second := time.Second +// fmt.Print(int64(second/time.Millisecond)) // prints 1000 +// +// To convert an integer number of units to a Duration, multiply: +// seconds := 10 +// fmt.Print(time.Duration(seconds)*time.Second) // prints 10s +// const ( Nanosecond Duration = 1 Microsecond = 1000 * Nanosecond @@ -758,10 +767,6 @@ func (t Time) UnixNano() int64 { return (t.sec+internalToUnix)*1e9 + int64(t.nsec) } -type gobError string - -func (g gobError) Error() string { return string(g) } - const timeGobVersion byte = 1 // GobEncode implements the gob.GobEncoder interface. |