(self)
| 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 + '"') |
nothing calls this directly
no outgoing calls
no test coverage detected