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
14
15
16
17
18 sources := []string{"../../lib/time/zoneinfo.zip"}
19 z, err := loadLocation("America/Los_Angeles", sources)
20 if err != nil {
21 panic("cannot load America/Los_Angeles for testing: " + err.Error() + "; you may want to use -tags=timetzdata")
22 }
23 z.name = "Local"
24 localLoc = *z
25 }
26
27 var origPlatformZoneSources []string = platformZoneSources
28
29 func disablePlatformSources() (undo func()) {
30 platformZoneSources = nil
31 return func() {
32 platformZoneSources = origPlatformZoneSources
33 }
34 }
35
36 var Interrupt = interrupt
37 var DaysIn = daysIn
38
39 func empty(arg any, seq uintptr, delta int64) {}
40
41
42
43
44
45
46 func CheckRuntimeTimerPeriodOverflow() {
47
48
49
50 t := newTimer(runtimeNano(), 1<<63-1, empty, nil, nil)
51 defer t.Stop()
52
53
54
55
56
57
58 <-After(25 * Millisecond)
59 }
60
61 var (
62 MinMonoTime = Time{wall: 1 << 63, ext: -1 << 63, loc: UTC}
63 MaxMonoTime = Time{wall: 1 << 63, ext: 1<<63 - 1, loc: UTC}
64
65 NotMonoNegativeTime = Time{wall: 0, ext: -1<<63 + 50}
66 )
67
View as plain text