Source file
src/time/internal_test.go
1
2
3
4
5 package time
6
7 func init() {
8
9 ForceUSPacificForTesting()
10 }
11
12 func initTestingZone() {
13 z, err := loadLocation("America/Los_Angeles", zoneSources[len(zoneSources)-1:])
14 if err != nil {
15 panic("cannot load America/Los_Angeles for testing: " + err.Error() + "; you may want to use -tags=timetzdata")
16 }
17 z.name = "Local"
18 localLoc = *z
19 }
20
21 var OrigZoneSources = zoneSources
22
23 func forceZipFileForTesting(zipOnly bool) {
24 zoneSources = make([]string, len(OrigZoneSources))
25 copy(zoneSources, OrigZoneSources)
26 if zipOnly {
27 zoneSources = zoneSources[len(zoneSources)-1:]
28 }
29 }
30
31 var Interrupt = interrupt
32 var DaysIn = daysIn
33
34 func empty(arg any, seq uintptr) {}
35
36
37
38
39
40
41 func CheckRuntimeTimerPeriodOverflow() {
42
43
44
45 r := &runtimeTimer{
46 when: runtimeNano(),
47 period: 1<<63 - 1,
48 f: empty,
49 arg: nil,
50 }
51 startTimer(r)
52 defer stopTimer(r)
53
54
55
56
57
58
59 <-After(25 * Millisecond)
60 }
61
62 var (
63 MinMonoTime = Time{wall: 1 << 63, ext: -1 << 63, loc: UTC}
64 MaxMonoTime = Time{wall: 1 << 63, ext: 1<<63 - 1, loc: UTC}
65
66 NotMonoNegativeTime = Time{wall: 0, ext: -1<<63 + 50}
67 )
68
View as plain text