...
Source file
src/time/internal_test.go
Documentation: time
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) {}
40
41
42
43
44
45
46 func CheckRuntimeTimerPeriodOverflow() {
47
48
49
50 r := &runtimeTimer{
51 when: runtimeNano(),
52 period: 1<<63 - 1,
53 f: empty,
54 arg: nil,
55 }
56 startTimer(r)
57 defer stopTimer(r)
58
59
60
61
62
63
64 <-After(25 * Millisecond)
65 }
66
67 var (
68 MinMonoTime = Time{wall: 1 << 63, ext: -1 << 63, loc: UTC}
69 MaxMonoTime = Time{wall: 1 << 63, ext: 1<<63 - 1, loc: UTC}
70
71 NotMonoNegativeTime = Time{wall: 0, ext: -1<<63 + 50}
72 )
73
View as plain text