with proc.oneshot():
uptime = timedelta(seconds=time() - proc.create_time())
uptime_minutes, uptime_seconds = divmod(uptime.seconds, 60)
uptime_hours, uptime_minutes = divmod(uptime_minutes, 60)
uptime_days, uptime_hours = divmod(uptime_hours, 24)
if uptime_seconds:
frmt_uptime = '{:01} Seconds'.format(
int(uptime_seconds))
if uptime_minutes:
frmt_uptime = '{:01} Minutes, {:01} Seconds'.format(
int(uptime_minutes),
int(uptime_seconds))
if uptime_hours:
frmt_uptime = '{:01} Hours, {:01} Minutes, {:01} Seconds'.format(
int(uptime_hours),
int(uptime_minutes),
int(uptime_seconds))
if uptime_days:
frmt_uptime = '{:01} Day(s), {:01} Hour(s), {:01} Minute(s), {:01} Second(s)'.format(
int(uptime_days),
int(uptime_hours),
int(uptime_minutes),
int(uptime_seconds))
print(frmt_uptime)
Now I want this to show the amount of days but for some reason currently it goes 23hrs 59mins 59secs and then should go 1 day. A second later 1 day, 1 second. A minute later, 1 day 1 minute. But currently it just seems to restart after 24hrs which leads me to believe something is wrong with how I am working out days.