Source file
src/time/export_test.go
1
2
3
4
5 package time
6
7 import (
8 "sync"
9 )
10
11 func ResetLocalOnceForTest() {
12 localOnce = sync.Once{}
13 localLoc = Location{}
14 }
15
16 func ForceUSPacificForTesting() {
17 ResetLocalOnceForTest()
18 localOnce.Do(initTestingZone)
19 }
20
21 func ZoneinfoForTesting() *string {
22 return zoneinfo
23 }
24
25 func ResetZoneinfoForTesting() {
26 zoneinfo = nil
27 zoneinfoOnce = sync.Once{}
28 }
29
30 var (
31 DisablePlatformSources = disablePlatformSources
32 GorootZoneSource = gorootZoneSource
33 ParseTimeZone = parseTimeZone
34 SetMono = (*Time).setMono
35 GetMono = (*Time).mono
36 ErrLocation = errLocation
37 ReadFile = readFile
38 LoadTzinfo = loadTzinfo
39 NextStdChunk = nextStdChunk
40 Tzset = tzset
41 TzsetName = tzsetName
42 TzsetOffset = tzsetOffset
43 )
44
45 func LoadFromEmbeddedTZData(zone string) (string, error) {
46 return loadFromEmbeddedTZData(zone)
47 }
48
49 type RuleKind int
50
51 const (
52 RuleJulian = RuleKind(ruleJulian)
53 RuleDOY = RuleKind(ruleDOY)
54 RuleMonthWeekDay = RuleKind(ruleMonthWeekDay)
55 UnixToInternal = unixToInternal
56 )
57
58 type Rule struct {
59 Kind RuleKind
60 Day int
61 Week int
62 Mon int
63 Time int
64 }
65
66 func TzsetRule(s string) (Rule, string, bool) {
67 r, rs, ok := tzsetRule(s)
68 rr := Rule{
69 Kind: RuleKind(r.kind),
70 Day: r.day,
71 Week: r.week,
72 Mon: r.mon,
73 Time: r.time,
74 }
75 return rr, rs, ok
76 }
77
78
79 var StdChunkNames = map[int]string{
80 0: "",
81 stdLongMonth: "January",
82 stdMonth: "Jan",
83 stdNumMonth: "1",
84 stdZeroMonth: "01",
85 stdLongWeekDay: "Monday",
86 stdWeekDay: "Mon",
87 stdDay: "2",
88 stdUnderDay: "_2",
89 stdZeroDay: "02",
90 stdUnderYearDay: "__2",
91 stdZeroYearDay: "002",
92 stdHour: "15",
93 stdHour12: "3",
94 stdZeroHour12: "03",
95 stdMinute: "4",
96 stdZeroMinute: "04",
97 stdSecond: "5",
98 stdZeroSecond: "05",
99 stdLongYear: "2006",
100 stdYear: "06",
101 stdPM: "PM",
102 stdpm: "pm",
103 stdTZ: "MST",
104 stdISO8601TZ: "Z0700",
105 stdISO8601SecondsTZ: "Z070000",
106 stdISO8601ShortTZ: "Z07",
107 stdISO8601ColonTZ: "Z07:00",
108 stdISO8601ColonSecondsTZ: "Z07:00:00",
109 stdNumTZ: "-0700",
110 stdNumSecondsTz: "-070000",
111 stdNumShortTZ: "-07",
112 stdNumColonTZ: "-07:00",
113 stdNumColonSecondsTZ: "-07:00:00",
114 stdFracSecond0 | 1<<stdArgShift: ".0",
115 stdFracSecond0 | 2<<stdArgShift: ".00",
116 stdFracSecond0 | 3<<stdArgShift: ".000",
117 stdFracSecond0 | 4<<stdArgShift: ".0000",
118 stdFracSecond0 | 5<<stdArgShift: ".00000",
119 stdFracSecond0 | 6<<stdArgShift: ".000000",
120 stdFracSecond0 | 7<<stdArgShift: ".0000000",
121 stdFracSecond0 | 8<<stdArgShift: ".00000000",
122 stdFracSecond0 | 9<<stdArgShift: ".000000000",
123 stdFracSecond9 | 1<<stdArgShift: ".9",
124 stdFracSecond9 | 2<<stdArgShift: ".99",
125 stdFracSecond9 | 3<<stdArgShift: ".999",
126 stdFracSecond9 | 4<<stdArgShift: ".9999",
127 stdFracSecond9 | 5<<stdArgShift: ".99999",
128 stdFracSecond9 | 6<<stdArgShift: ".999999",
129 stdFracSecond9 | 7<<stdArgShift: ".9999999",
130 stdFracSecond9 | 8<<stdArgShift: ".99999999",
131 stdFracSecond9 | 9<<stdArgShift: ".999999999",
132 }
133
134 var Quote = quote
135
136 var AppendInt = appendInt
137 var AppendFormatAny = Time.appendFormat
138 var AppendFormatRFC3339 = Time.appendFormatRFC3339
139 var ParseAny = parse
140 var ParseRFC3339 = parseRFC3339[string]
141
View as plain text