Eclectic Media Git pingstats / f0c1d06
Made screen update logic smarter Ariana Giroux 1 year, 7 months ago
1 changed file(s) with 9 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
3030 parsed = parser.parse_args()
3131 y = []
3232
33 print('Waiting for first ping...') # Notify user in case of high ping
34
3335 while 1:
36 time_start = time.time()
37
3438 temp_file = NamedTemporaryFile()
3539 process = Popen(['ping', '-c 1', parsed.address], stdout=temp_file)
40
3641 process.wait()
3742
3843 with open(temp_file.name) as tf:
4853 elif line.lower().count('timeout'):
4954 y = -10
5055
51 # plot(table.y, table.x)
56 if time.time() - time_start < 0.5: # Wait for time if no time elapsed
57 time.sleep(0.5 - (time.time() - time_start))
58
59 system('clear' if not name == 'nt' else 'cls')
5260 plot(y)
53 time.sleep(0.5)
54 system('clear' if not name == 'nt' else 'cls')
5561
5662
5763 if __name__ == '__main__':