LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package time_test | 5 package time_test |
6 | 6 |
7 import ( | 7 import ( |
8 "bytes" | 8 "bytes" |
9 "encoding/gob" | 9 "encoding/gob" |
10 "encoding/json" | 10 "encoding/json" |
(...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1311 {"15m", true, 15 * Minute}, | 1311 {"15m", true, 15 * Minute}, |
1312 {"16h", true, 16 * Hour}, | 1312 {"16h", true, 16 * Hour}, |
1313 // composite durations | 1313 // composite durations |
1314 {"3h30m", true, 3*Hour + 30*Minute}, | 1314 {"3h30m", true, 3*Hour + 30*Minute}, |
1315 {"10.5s4m", true, 4*Minute + 10*Second + 500*Millisecond}, | 1315 {"10.5s4m", true, 4*Minute + 10*Second + 500*Millisecond}, |
1316 {"-2m3.4s", true, -(2*Minute + 3*Second + 400*Millisecond)}, | 1316 {"-2m3.4s", true, -(2*Minute + 3*Second + 400*Millisecond)}, |
1317 {"1h2m3s4ms5us6ns", true, 1*Hour + 2*Minute + 3*Second + 4*Millisecond +
5*Microsecond + 6*Nanosecond}, | 1317 {"1h2m3s4ms5us6ns", true, 1*Hour + 2*Minute + 3*Second + 4*Millisecond +
5*Microsecond + 6*Nanosecond}, |
1318 {"39h9m14.425s", true, 39*Hour + 9*Minute + 14*Second + 425*Millisecond}
, | 1318 {"39h9m14.425s", true, 39*Hour + 9*Minute + 14*Second + 425*Millisecond}
, |
1319 // large value | 1319 // large value |
1320 {"52763797000ns", true, 52763797000 * Nanosecond}, | 1320 {"52763797000ns", true, 52763797000 * Nanosecond}, |
| 1321 // more than 9 digits after decimal point, see http://golang.org/issue/6
617 |
| 1322 {"0.3333333333333333333h", true, 20 * Minute}, |
1321 | 1323 |
1322 // errors | 1324 // errors |
1323 {"", false, 0}, | 1325 {"", false, 0}, |
1324 {"3", false, 0}, | 1326 {"3", false, 0}, |
1325 {"-", false, 0}, | 1327 {"-", false, 0}, |
1326 {"s", false, 0}, | 1328 {"s", false, 0}, |
1327 {".", false, 0}, | 1329 {".", false, 0}, |
1328 {"-.", false, 0}, | 1330 {"-.", false, 0}, |
1329 {".s", false, 0}, | 1331 {".s", false, 0}, |
1330 {"+.s", false, 0}, | 1332 {"+.s", false, 0}, |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1503 _ = t.Year() | 1505 _ = t.Year() |
1504 } | 1506 } |
1505 } | 1507 } |
1506 | 1508 |
1507 func BenchmarkDay(b *testing.B) { | 1509 func BenchmarkDay(b *testing.B) { |
1508 t := Now() | 1510 t := Now() |
1509 for i := 0; i < b.N; i++ { | 1511 for i := 0; i < b.N; i++ { |
1510 _ = t.Day() | 1512 _ = t.Day() |
1511 } | 1513 } |
1512 } | 1514 } |
LEFT | RIGHT |