MCPcopy Create free account
hub / github.com/dateutil/dateutil / get_current_tz

Method get_current_tz

tests/_common.py:264–273  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

262 variable to a truthy value before using this context manager.
263 """
264 def get_current_tz(self):
265 p = subprocess.Popen(['tzutil', '/g'], stdout=subprocess.PIPE)
266
267 ctzname, err = p.communicate()
268 ctzname = ctzname.decode() # Popen returns
269
270 if p.returncode:
271 raise OSError('Failed to get current time zone: ' + err)
272
273 return ctzname
274
275 def set_current_tz(self, tzname):
276 p = subprocess.Popen('tzutil /s "' + tzname + '"')

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected