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

Method get_current_tz

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

Source from the content-addressed store, hash-verified

142 variable to a truthy value before using this context manager.
143 """
144 def get_current_tz(self):
145 p = subprocess.Popen(['tzutil', '/g'], stdout=subprocess.PIPE)
146
147 ctzname, err = p.communicate()
148 ctzname = ctzname.decode() # Popen returns
149
150 if p.returncode:
151 raise OSError('Failed to get current time zone: ' + err)
152
153 return ctzname
154
155 def set_current_tz(self, tzname):
156 p = subprocess.Popen('tzutil /s "' + tzname + '"')

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected