OLD | NEW |
1 # Copyright 2015 The LUCI Authors. All rights reserved. | 1 # Copyright 2015 The LUCI Authors. All rights reserved. |
2 # Use of this source code is governed by the Apache v2.0 license that can be | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
3 # found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
4 | 4 |
5 """Windows specific utility functions.""" | 5 """Windows specific utility functions.""" |
6 | 6 |
7 import ctypes | 7 import ctypes |
8 import logging | 8 import logging |
9 import os | 9 import os |
10 import platform | 10 import platform |
11 import re | 11 import re |
12 import string | 12 import string |
13 import subprocess | 13 import subprocess |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 | 406 |
407 def get_uptime(): | 407 def get_uptime(): |
408 """Return uptime for Windows 7 and later. | 408 """Return uptime for Windows 7 and later. |
409 | 409 |
410 Excludes sleep time. | 410 Excludes sleep time. |
411 """ | 411 """ |
412 val = ctypes.c_ulonglong(0) | 412 val = ctypes.c_ulonglong(0) |
413 if ctypes.windll.kernel32.QueryUnbiasedInterruptTime(ctypes.byref(val)) != 0: | 413 if ctypes.windll.kernel32.QueryUnbiasedInterruptTime(ctypes.byref(val)) != 0: |
414 return val.value / 10000000. | 414 return val.value / 10000000. |
415 return 0. | 415 return 0. |
OLD | NEW |