fix uptime for MacOS
This commit is contained in:
@@ -9,6 +9,7 @@ dependencies = [
|
|||||||
"geopy[aiohttp]==2.4.1",
|
"geopy[aiohttp]==2.4.1",
|
||||||
"httpx>=0.28.1",
|
"httpx>=0.28.1",
|
||||||
"numpy==2.4.3",
|
"numpy==2.4.3",
|
||||||
|
"psutil>=7.2.2",
|
||||||
"pydantic==2.12.5",
|
"pydantic==2.12.5",
|
||||||
"pyicloud>=2.4.1",
|
"pyicloud>=2.4.1",
|
||||||
"pymobiledevice3==9.8.1",
|
"pymobiledevice3==9.8.1",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
|
import psutil
|
||||||
|
import datetime
|
||||||
import math
|
import math
|
||||||
import random
|
import random
|
||||||
import traceback
|
import traceback
|
||||||
@@ -563,10 +565,10 @@ class SimulationService:
|
|||||||
}
|
}
|
||||||
|
|
||||||
def get_uptime(self) -> float:
|
def get_uptime(self) -> float:
|
||||||
with open('/proc/uptime', 'r') as f:
|
boot_time_timestamp = psutil.boot_time()
|
||||||
# The first number is total uptime seconds
|
boot_time = datetime.datetime.fromtimestamp(boot_time_timestamp)
|
||||||
uptime_seconds = float(f.readline().split()[0])
|
uptime = datetime.datetime.now() - boot_time
|
||||||
return uptime_seconds
|
return uptime
|
||||||
|
|
||||||
def get_status(self) -> dict:
|
def get_status(self) -> dict:
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1347,6 +1347,7 @@ dependencies = [
|
|||||||
{ name = "geopy", extra = ["aiohttp"] },
|
{ name = "geopy", extra = ["aiohttp"] },
|
||||||
{ name = "httpx" },
|
{ name = "httpx" },
|
||||||
{ name = "numpy" },
|
{ name = "numpy" },
|
||||||
|
{ name = "psutil" },
|
||||||
{ name = "pydantic" },
|
{ name = "pydantic" },
|
||||||
{ name = "pyicloud" },
|
{ name = "pyicloud" },
|
||||||
{ name = "pymobiledevice3" },
|
{ name = "pymobiledevice3" },
|
||||||
@@ -1368,6 +1369,7 @@ requires-dist = [
|
|||||||
{ name = "geopy", extras = ["aiohttp"], specifier = "==2.4.1" },
|
{ name = "geopy", extras = ["aiohttp"], specifier = "==2.4.1" },
|
||||||
{ name = "httpx", specifier = ">=0.28.1" },
|
{ name = "httpx", specifier = ">=0.28.1" },
|
||||||
{ name = "numpy", specifier = "==2.4.3" },
|
{ name = "numpy", specifier = "==2.4.3" },
|
||||||
|
{ name = "psutil", specifier = ">=7.2.2" },
|
||||||
{ name = "pydantic", specifier = "==2.12.5" },
|
{ name = "pydantic", specifier = "==2.12.5" },
|
||||||
{ name = "pyicloud", specifier = ">=2.4.1" },
|
{ name = "pyicloud", specifier = ">=2.4.1" },
|
||||||
{ name = "pymobiledevice3", specifier = "==9.8.1" },
|
{ name = "pymobiledevice3", specifier = "==9.8.1" },
|
||||||
|
|||||||
Reference in New Issue
Block a user