OLD | NEW |
1 # Copyright 2015 The Swarming 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 by the Apache v2.0 license that can be |
3 # found in the LICENSE file. | 3 # 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 |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 | 404 |
405 def get_uptime(): | 405 def get_uptime(): |
406 """Return uptime for Windows 7 and later. | 406 """Return uptime for Windows 7 and later. |
407 | 407 |
408 Excludes sleep time. | 408 Excludes sleep time. |
409 """ | 409 """ |
410 val = ctypes.c_ulonglong(0) | 410 val = ctypes.c_ulonglong(0) |
411 if ctypes.windll.kernel32.QueryUnbiasedInterruptTime(ctypes.byref(val)) != 0: | 411 if ctypes.windll.kernel32.QueryUnbiasedInterruptTime(ctypes.byref(val)) != 0: |
412 return val.value / 10000000. | 412 return val.value / 10000000. |
413 return 0. | 413 return 0. |
OLD | NEW |