From c258a07015291023d705a8de1f06a879cd5af15d Mon Sep 17 00:00:00 2001 From: Anthony Scopatz Date: Sat, 4 Feb 2017 15:20:35 -0500 Subject: [PATCH] unpack from --- xonsh/xoreutils/uptime.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xonsh/xoreutils/uptime.py b/xonsh/xoreutils/uptime.py index 1c5184670..18db08933 100644 --- a/xonsh/xoreutils/uptime.py +++ b/xonsh/xoreutils/uptime.py @@ -28,7 +28,7 @@ def _uptime_osx(): """Returns the uptime on mac / darwin.""" global _BOOTTIME bt = xlimps.macutils.sysctlbyname("kern.boottime", return_str=False) - bt = struct.unpack('@ll', bt) + bt = struct.unpack_from('@LL', bt) bt = bt[0] + bt[1]*1e-6 if bt == 0.0: return None @@ -100,7 +100,7 @@ def _uptime_bsd(): # For real now. buf = ctypes.create_string_buffer(sz.value) xp.LIBC.sysctlbyname('kern.boottime', buf, ctypes.byref(sz), None, 0) - sec, usec = struct.unpack('@LL', buf.raw) + sec, usec = struct.unpack_from('@LL', buf.raw) # OS X disagrees what that second value is. if usec > 1000000: usec = 0.