Skip to content

Commit

Permalink
time: add boot_time()
Browse files Browse the repository at this point in the history
  • Loading branch information
yotamolenik committed Apr 18, 2023
1 parent 18691a9 commit fd73dc4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/rpcclient/rpcclient/darwin/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ def set_auto(self):
def is_set_automatically(self):
""" tell is time settings are set to automatic """
return bool(self._client.symbols.TMIsAutomaticTimeZoneEnabled())

def boot_time(self) -> datetime:
timestamp = timeval.parse(self._client.sysctl.get_by_name('kern.boottime')).tv_sec
return datetime.fromtimestamp(timestamp)

0 comments on commit fd73dc4

Please sign in to comment.