37
37
TIME_FORMAT_EXTENDED = "%H:%M:%S"
38
38
TIME_FORMAT_EXTENDED_SUB_SECOND = "%H:%M:%S.%f"
39
39
40
- TIME_ZONE_STRING_LOCAL_BASIC = get_local_time_zone_format (
41
- TimeZoneFormatMode .reduced )
42
- TIME_ZONE_STRING_LOCAL_EXTENDED = get_local_time_zone_format (
43
- TimeZoneFormatMode .extended )
44
40
TIME_ZONE_STRING_UTC = "Z"
45
41
TIME_ZONE_UTC_UTC_OFFSET = (0 , 0 )
46
- TIME_ZONE_LOCAL_UTC_OFFSET = get_local_time_zone ()
47
- TIME_ZONE_LOCAL_UTC_OFFSET_HOURS = TIME_ZONE_LOCAL_UTC_OFFSET [0 ]
48
- TIME_ZONE_LOCAL_UTC_OFFSET_MINUTES = TIME_ZONE_LOCAL_UTC_OFFSET [1 ]
49
42
50
43
TIME_ZONE_LOCAL_INFO = {
51
- "hours" : TIME_ZONE_LOCAL_UTC_OFFSET [0 ],
52
- "minutes" : TIME_ZONE_LOCAL_UTC_OFFSET [1 ],
53
- "string_basic" : TIME_ZONE_STRING_LOCAL_BASIC ,
54
- "string_extended" : TIME_ZONE_STRING_LOCAL_EXTENDED
44
+ "hours" : get_local_time_zone ()[0 ],
45
+ "minutes" : get_local_time_zone ()[1 ],
46
+ "string_basic" : get_local_time_zone_format (
47
+ TimeZoneFormatMode .reduced ),
48
+ "string_extended" : get_local_time_zone_format (
49
+ TimeZoneFormatMode .extended )
55
50
}
56
51
57
52
TIME_ZONE_UTC_INFO = {
@@ -149,8 +144,8 @@ def get_time_string(date_time, display_sub_seconds=False,
149
144
else :
150
145
custom_string = custom_time_zone_info ["string_extended" ]
151
146
if date_time_is_local :
152
- date_time_hours = TIME_ZONE_LOCAL_UTC_OFFSET_HOURS
153
- date_time_minutes = TIME_ZONE_LOCAL_UTC_OFFSET_MINUTES
147
+ date_time_hours = get_local_time_zone ()[ 0 ]
148
+ date_time_minutes = get_local_time_zone ()[ 1 ]
154
149
else :
155
150
date_time_hours , date_time_minutes = (0 , 0 )
156
151
diff_hours = custom_hours - date_time_hours
@@ -162,17 +157,19 @@ def get_time_string(date_time, display_sub_seconds=False,
162
157
time_zone_string = TIME_ZONE_STRING_UTC
163
158
if date_time_is_local :
164
159
date_time = date_time - timedelta (
165
- hours = TIME_ZONE_LOCAL_UTC_OFFSET_HOURS ,
166
- minutes = TIME_ZONE_LOCAL_UTC_OFFSET_MINUTES
160
+ hours = get_local_time_zone ()[ 0 ] ,
161
+ minutes = get_local_time_zone ()[ 1 ]
167
162
)
168
163
else :
169
164
if use_basic_format :
170
- time_zone_string = TIME_ZONE_STRING_LOCAL_BASIC
165
+ time_zone_string = get_local_time_zone_format (
166
+ TimeZoneFormatMode .reduced )
171
167
else :
172
- time_zone_string = TIME_ZONE_STRING_LOCAL_EXTENDED
168
+ time_zone_string = get_local_time_zone_format (
169
+ TimeZoneFormatMode .extended )
173
170
if not date_time_is_local :
174
- diff_hours = TIME_ZONE_LOCAL_UTC_OFFSET_HOURS
175
- diff_minutes = TIME_ZONE_LOCAL_UTC_OFFSET_MINUTES
171
+ diff_hours = get_local_time_zone ()[ 0 ]
172
+ diff_minutes = get_local_time_zone ()[ 1 ]
176
173
date_time = date_time + timedelta (
177
174
hours = diff_hours , minutes = diff_minutes )
178
175
if use_basic_format :
0 commit comments