mirror of https://github.com/aristocratos/bpytop
Fixed: Program not stalling when system time is changed and regular update of current timezone
parent
9ae64e9cdd
commit
fd362b5fef
11
bpytop.py
11
bpytop.py
|
@ -1662,6 +1662,7 @@ class Box:
|
||||||
_b_mem_h: int
|
_b_mem_h: int
|
||||||
redraw_all: bool
|
redraw_all: bool
|
||||||
buffers: List[str] = []
|
buffers: List[str] = []
|
||||||
|
c_counter: int = 0
|
||||||
clock_on: bool = False
|
clock_on: bool = False
|
||||||
clock: str = ""
|
clock: str = ""
|
||||||
clock_len: int = 0
|
clock_len: int = 0
|
||||||
|
@ -1701,6 +1702,10 @@ class Box:
|
||||||
@classmethod
|
@classmethod
|
||||||
def draw_clock(cls, force: bool = False):
|
def draw_clock(cls, force: bool = False):
|
||||||
if not "cpu" in cls.boxes or not cls.clock_on: return
|
if not "cpu" in cls.boxes or not cls.clock_on: return
|
||||||
|
cls.c_counter += 1
|
||||||
|
if cls.c_counter > 3600 / (Config.update_ms / 1000):
|
||||||
|
time.tzset()
|
||||||
|
cls.c_counter = 0
|
||||||
out: str = ""
|
out: str = ""
|
||||||
if force: pass
|
if force: pass
|
||||||
elif Term.resized or strftime(CONFIG.draw_clock) == cls.clock: return
|
elif Term.resized or strftime(CONFIG.draw_clock) == cls.clock: return
|
||||||
|
@ -4975,7 +4980,11 @@ class Timer:
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def left(cls) -> float:
|
def left(cls) -> float:
|
||||||
return cls.timestamp + (CONFIG.update_ms / 1000) - time()
|
t_left: float = cls.timestamp + (CONFIG.update_ms / 1000) - time()
|
||||||
|
if t_left > CONFIG.update_ms / 1000:
|
||||||
|
cls.stamp()
|
||||||
|
return CONFIG.update_ms / 1000
|
||||||
|
return t_left
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def finish(cls):
|
def finish(cls):
|
||||||
|
|
Loading…
Reference in New Issue