Changeset View
Changeset View
Standalone View
Standalone View
head/shells/xonsh/files/patch-xonsh_xoreutils_uptime.py
--- xonsh/xoreutils/uptime.py.orig 2017-02-11 16:24:07 UTC | --- xonsh/xoreutils/uptime.py.orig 2018-09-05 14:16:47 UTC | ||||
+++ xonsh/xoreutils/uptime.py | +++ xonsh/xoreutils/uptime.py | ||||
@@ -100,7 +100,7 @@ def _uptime_bsd(): | @@ -100,13 +100,13 @@ def _uptime_bsd(): | ||||
return None | return None | ||||
# Determine how much space we need for the response. | # Determine how much space we need for the response. | ||||
sz = ctypes.c_uint(0) | sz = ctypes.c_uint(0) | ||||
- xp.LIBC.sysctlbyname('kern.boottime', None, ctypes.byref(sz), None, 0) | - xp.LIBC.sysctlbyname("kern.boottime", None, ctypes.byref(sz), None, 0) | ||||
+ xp.LIBC.sysctlbyname(b'kern.boottime', None, ctypes.byref(sz), None, 0) | + xp.LIBC.sysctlbyname(b"kern.boottime", None, ctypes.byref(sz), None, 0) | ||||
if sz.value != struct.calcsize('@LL'): | if sz.value != struct.calcsize("@LL"): | ||||
# Unexpected, let's give up. | # Unexpected, let's give up. | ||||
return None | return None | ||||
# For real now. | |||||
buf = ctypes.create_string_buffer(sz.value) | |||||
- xp.LIBC.sysctlbyname("kern.boottime", buf, ctypes.byref(sz), None, 0) | |||||
+ xp.LIBC.sysctlbyname(b"kern.boottime", buf, ctypes.byref(sz), None, 0) | |||||
sec, usec = struct.unpack_from("@LL", buf.raw) | |||||
# OS X disagrees what that second value is. | |||||
if usec > 1000000: |