public:watches:watchcheck
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
public:watches:watchcheck [04/05/22 10:22 BST] – gm4slv | public:watches:watchcheck [06/03/25 06:49 GMT] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 12: | Line 12: | ||
directory. the data from each measurement is stored in a **json** file in the same directory. | directory. the data from each measurement is stored in a **json** file in the same directory. | ||
- | + | ++++ watchcheck.py | | |
- | <code python> | + | <file python |
#! / | #! / | ||
Line 210: | Line 210: | ||
menu() | menu() | ||
- | </code> | + | </file> |
+ | ++++ | ||
Running it for the first time, with no previous records stored, looks like this: | Running it for the first time, with no previous records stored, looks like this: | ||
Line 242: | Line 243: | ||
</ | </ | ||
- | I'll update | + | Running it again, after only 10 minutes looks like this: |
+ | |||
+ | < | ||
+ | Command > : n | ||
+ | New | ||
+ | Current Time = 10:30 | ||
+ | Watch time 10:30 | ||
+ | 30 | ||
+ | Press enter when seconds = 0 | ||
+ | |||
+ | 2022/05/04 10:30:30 | ||
+ | |||
+ | Delta -30.2 seconds | ||
+ | First record time 2022/05/04 10:19:30 | ||
+ | First record delta -30.1799800396 | ||
+ | |||
+ | Previous record time 2022/05/04 10:19:30 | ||
+ | Previous record delta -30.1799800396 | ||
+ | |||
+ | Latest record time 2022/05/04 10:30:30 | ||
+ | Latest record delta -30.1998269558 | ||
+ | |||
+ | Overall elapsed time 0:11:00 | ||
+ | Latest elapsed time 0:11:00 | ||
+ | |||
+ | Latest delta change | ||
+ | Latest elapsed time 660 seconds | ||
+ | |||
+ | Daily PPM : -30.071 | ||
+ | Daily rate error: -2.6 s/d | ||
+ | |||
+ | Total Time 660 seconds | ||
+ | Total error -0.0198469161987 | ||
+ | Total PPM : -30.071 | ||
+ | Total rate error: -2.6 s/d | ||
+ | |||
+ | ======================================================== | ||
+ | Delta : -30.2 s | Rate : -2.6 s/d | Average : -2.6 s/d | ||
+ | ======================================================== | ||
+ | </ | ||
+ | |||
+ | The '' | ||
+ | |||
+ | < | ||
+ | [[" | ||
+ | </ | ||
+ | |||
+ | |||
+ | There' | ||
+ | display the data | ||
+ | |||
+ | ++++ watchstat.py | | ||
+ | |||
+ | <file python watchstat.py> | ||
+ | #! / | ||
+ | |||
+ | ## a text-terminal version of the WatchCheck app | ||
+ | ## to track error, daily error rate of timepieces. | ||
+ | |||
+ | # | ||
+ | import time | ||
+ | import datetime | ||
+ | import json | ||
+ | |||
+ | |||
+ | |||
+ | def watch_stat(): | ||
+ | |||
+ | try: | ||
+ | saved_error = open(' | ||
+ | error_list = json.load(saved_error) | ||
+ | except: | ||
+ | error_list = [] | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | if len(error_list) > 1: | ||
+ | first_record = error_list[0] | ||
+ | latest_record = error_list[-1] | ||
+ | previous_record = error_list[-2] | ||
+ | |||
+ | first_time = first_record[0] | ||
+ | |||
+ | first_delta = first_record[1] | ||
+ | |||
+ | latest_time = latest_record[0] | ||
+ | latest_delta = latest_record[1] | ||
+ | |||
+ | previous_time = previous_record[0] | ||
+ | previous_delta = previous_record[1] | ||
+ | |||
+ | FMT = ' | ||
+ | |||
+ | t_latest = datetime.datetime.strptime(latest_time, | ||
+ | t_previous = datetime.datetime.strptime(previous_time, | ||
+ | t_first = datetime.datetime.strptime(first_time, | ||
+ | |||
+ | tdelta = t_latest - t_previous | ||
+ | full_delta = t_latest - t_first | ||
+ | |||
+ | elapsed_time = tdelta.total_seconds() | ||
+ | |||
+ | full_time = full_delta.total_seconds() | ||
+ | |||
+ | print "First record time ", first_time | ||
+ | print "First record delta ", first_delta | ||
+ | print "" | ||
+ | |||
+ | print " | ||
+ | print " | ||
+ | print "" | ||
+ | |||
+ | print " | ||
+ | print " | ||
+ | print "" | ||
+ | |||
+ | print " | ||
+ | print " | ||
+ | print "" | ||
+ | |||
+ | # Current Error rate | ||
+ | time_error = latest_delta - previous_delta | ||
+ | error_rate = time_error / elapsed_time | ||
+ | daily_rate = error_rate * (60*60*24) | ||
+ | ppm_daily = error_rate * 1000000 | ||
+ | |||
+ | # Overall Error rate | ||
+ | total_error = latest_delta - first_delta | ||
+ | average_error_rate = total_error / full_time | ||
+ | |||
+ | average_rate = average_error_rate * (60*60*24) | ||
+ | ppm_overall = average_error_rate * 1000000 | ||
+ | |||
+ | |||
+ | print " | ||
+ | |||
+ | print " | ||
+ | |||
+ | print "" | ||
+ | print "Daily PPM : %0.3f" % ppm_daily | ||
+ | print "Daily rate error: %0.1f s/d " % (daily_rate) | ||
+ | |||
+ | print "" | ||
+ | print "Total Time %d seconds" | ||
+ | print "Total error ", total_error | ||
+ | print "Total PPM : %0.3f" % ppm_overall | ||
+ | print "Total rate error: %0.1f s/d" % (average_rate) | ||
+ | print "" | ||
+ | print " | ||
+ | print " Delta : %0.1f s | Rate : %0.1f s/d | Average : %0.1f s/d" % (latest_delta, | ||
+ | print " | ||
+ | print "" | ||
+ | else: | ||
+ | print "No rate yet" | ||
+ | |||
+ | |||
+ | watch_stat() | ||
+ | </ | ||
+ | |||
+ | ++++ | ||
+ | |||
+ | Running watchstat.py on the newly updated '' | ||
+ | |||
+ | < | ||
+ | gm4slv@laptop: | ||
+ | First record time 2022/05/04 10:19:30 | ||
+ | First record delta -30.1799800396 | ||
+ | |||
+ | Previous record time 2022/05/04 10:19:30 | ||
+ | Previous record delta -30.1799800396 | ||
+ | |||
+ | Latest record time 2022/05/04 10:30:30 | ||
+ | Latest record delta -30.1998269558 | ||
+ | |||
+ | Overall elapsed time 0:11:00 | ||
+ | Latest elapsed time 0:11:00 | ||
+ | |||
+ | Latest delta change | ||
+ | Latest elapsed time 660 seconds | ||
+ | |||
+ | Daily PPM : -30.071 | ||
+ | Daily rate error: -2.6 s/d | ||
+ | |||
+ | Total Time 660 seconds | ||
+ | Total error -0.0198469161987 | ||
+ | Total PPM : -30.071 | ||
+ | Total rate error: -2.6 s/d | ||
+ | |||
+ | ======================================================== | ||
+ | Delta : -30.2 s | Rate : -2.6 s/d | Average : -2.6 s/d | ||
+ | ======================================================== | ||
+ | </ | ||
+ | |||
+ | '' | ||
+ | |||
+ | < | ||
+ | 04/05/2022 09: | ||
+ | </ | ||
+ | |||
+ | The fields are "date time", current error, error in seconds per day since last record, average error in seconds per day since the start. | ||
+ | |||
+ | This mimics the behaviour of the Android Watchcheck app | ||
+ | {{: | ||
// | // |
public/watches/watchcheck.1651656172.txt.gz · Last modified: 06/03/25 06:49 GMT (external edit)