-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
tzinfo.go
138 lines (116 loc) · 3.79 KB
/
tzinfo.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
package timezone
// TzInfo represents information about a particular timezone.
type TzInfo struct {
longGeneric string
longStandard string
longDaylight string
shortGeneric string
shortStandard string
shortDaylight string
standardOffset int
daylightOffset int
standardOffsetHHMM string
daylightOffsetHHMM string
countryCode string
isDeprecated bool
linkTo string
lastDST int
}
// LongGeneric returns the generic time name.
// It returns the empty string if there is no generic time name.
func (ti *TzInfo) LongGeneric() string {
return ti.longGeneric
}
// LongStandard returns the standard time name.
func (ti *TzInfo) LongStandard() string {
return ti.longStandard
}
// LongDaylight returns the daylight saving time name.
// It returns the empty string if there is no daylight saving time name.
func (ti *TzInfo) LongDaylight() string {
return ti.longDaylight
}
// ShortGeneric returns the generic timezone abbreviation.
// It returns the empty string if there is no generic timezone abbreviation.
func (ti *TzInfo) ShortGeneric() string {
return ti.shortGeneric
}
// ShortStandard returns the standard timezone abbreviation.
func (ti *TzInfo) ShortStandard() string {
return ti.shortStandard
}
// ShortDaylight returns the daylight saving timezone abbreviation.
// It returns the empty string if there is no daylight saving timezone abbreviation.
func (ti *TzInfo) ShortDaylight() string {
return ti.shortDaylight
}
// StandardOffset returns the standard time offset
func (ti *TzInfo) StandardOffset() int {
return ti.standardOffset
}
// DaylightOffset returns the daylight saving time offset
// It returns the 0 if there is no daylight saving.
func (ti *TzInfo) DaylightOffset() int {
return ti.daylightOffset
}
// StandardOffsetHHMM returns the standard time offset in (+/-)hh:mm format.
func (ti *TzInfo) StandardOffsetHHMM() string {
return ti.standardOffsetHHMM
}
// DaylightOffsetHHMM returns the daylight saving time offset in (+/-)hh:mm format.
// It returns the "+00:00" if there is no daylight saving.
func (ti *TzInfo) DaylightOffsetHHMM() string {
return ti.daylightOffsetHHMM
}
// CountryCode returns the ISO 3166-1 alpha-2 country code.
// It returns the empty string if there is no CountryCode.
func (ti *TzInfo) CountryCode() string {
return ti.countryCode
}
// IsDeprecated reports whether the timezone is deprecated.
func (ti *TzInfo) IsDeprecated() bool {
return ti.isDeprecated
}
// LinkTo returns the source of the alias.
// It returns the empty string if there is no alias.
func (ti *TzInfo) LinkTo() string {
return ti.linkTo
}
// LastDST returns the last year when there was daylight savings time.
// It returns the 0 if has never observed daylight savings.
func (ti *TzInfo) LastDST() int {
return ti.lastDST
}
// HasDST reports whether or not it has daylight savings time.
func (ti *TzInfo) HasDST() bool {
return ti.longDaylight != ""
}
// TzAbbreviationInfo represents timezone abbreviation information about a particular timezone.
type TzAbbreviationInfo struct {
countryCode string
isDST bool
name string
offset int
offsetHHMM string
}
// CountryCode returns the ISO 3166-1 alpha-2 country code.
// It returns the empty string if there is no CountryCode.
func (tai *TzAbbreviationInfo) CountryCode() string {
return tai.countryCode
}
// IsDST reports whether or not it is daylight savings time.
func (tai *TzAbbreviationInfo) IsDST() bool {
return tai.isDST
}
// Name returns the time name.
func (tai *TzAbbreviationInfo) Name() string {
return tai.name
}
// Offset returns the time offset.
func (tai *TzAbbreviationInfo) Offset() int {
return tai.offset
}
// OffsetHHMM returns the time offset in (+/-)hh:mm format.
func (tai *TzAbbreviationInfo) OffsetHHMM() string {
return tai.offsetHHMM
}