Mercurial > hg > cc > cirrus_work
annotate bin/wprog.py @ 396:10813bab9072 plus tip
added test 9 for wat that pretty-prints json content
| author | Henry S. Thompson <ht@inf.ed.ac.uk> |
|---|---|
| date | Tue, 30 Jun 2026 16:50:56 +0100 |
| parents | 2502b81838da |
| children |
| rev | line source |
|---|---|
|
318
2502b81838da
for tracking progress (of w2c?)
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
1 #!/usr/bin/python3 |
|
2502b81838da
for tracking progress (of w2c?)
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
2 import sys, datetime |
|
2502b81838da
for tracking progress (of w2c?)
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
3 (s,d1,d2) = sys.argv[1:4] |
|
2502b81838da
for tracking progress (of w2c?)
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
4 dd2 = datetime.datetime.strptime(d2[4:22],"%b %d %I:%M:%S %p") |
|
2502b81838da
for tracking progress (of w2c?)
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
5 dd1 = datetime.datetime.strptime(d1[4:18],"%b %d %H:%M:%S") |
|
2502b81838da
for tracking progress (of w2c?)
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
6 d = (dd2 - dd1).seconds |
|
2502b81838da
for tracking progress (of w2c?)
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
7 h = d / 3600 |
|
2502b81838da
for tracking progress (of w2c?)
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
8 print("%.2f %d:%0.2d:%0.2d %.2f"%(a := float(s), |
|
2502b81838da
for tracking progress (of w2c?)
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
9 h, (m := (d % 3600)) / 60, m % 60, a / h)) |
