diff options
Diffstat (limited to 'libgo/go/time/example_test.go')
-rw-r--r-- | libgo/go/time/example_test.go | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/libgo/go/time/example_test.go b/libgo/go/time/example_test.go index 8c64506027f..494a4168025 100644 --- a/libgo/go/time/example_test.go +++ b/libgo/go/time/example_test.go @@ -74,17 +74,17 @@ func ExampleDuration_Truncate() { } for _, t := range trunc { - fmt.Printf("t.Truncate(%6s) = %s\n", t, d.Truncate(t).String()) + fmt.Printf("d.Truncate(%6s) = %s\n", t, d.Truncate(t).String()) } // Output: - // t.Truncate( 1ns) = 1h15m30.918273645s - // t.Truncate( 1µs) = 1h15m30.918273s - // t.Truncate( 1ms) = 1h15m30.918s - // t.Truncate( 1s) = 1h15m30s - // t.Truncate( 2s) = 1h15m30s - // t.Truncate( 1m0s) = 1h15m0s - // t.Truncate( 10m0s) = 1h10m0s - // t.Truncate(1h0m0s) = 1h0m0s + // d.Truncate( 1ns) = 1h15m30.918273645s + // d.Truncate( 1µs) = 1h15m30.918273s + // d.Truncate( 1ms) = 1h15m30.918s + // d.Truncate( 1s) = 1h15m30s + // d.Truncate( 2s) = 1h15m30s + // d.Truncate( 1m0s) = 1h15m0s + // d.Truncate( 10m0s) = 1h10m0s + // d.Truncate(1h0m0s) = 1h0m0s } func ExampleParseDuration() { @@ -598,3 +598,10 @@ func ExampleTime_AppendFormat() { // Output: // Time: 11:00AM } + +func ExampleFixedZone() { + loc := time.FixedZone("UTC-8", -8*60*60) + t := time.Date(2009, time.November, 10, 23, 0, 0, 0, loc) + fmt.Println("The time is:", t.Format(time.RFC822)) + // Output: The time is: 10 Nov 09 23:00 UTC-8 +} |