| Revision 375,
608 bytes
checked in by jdalbey, 7 years ago
(diff) |
|
Move runTimer.py to spikes folder
|
-
Property svn:executable set to
*
|
| Line | |
|---|
| 1 | #!/usr/bin/python |
|---|
| 2 | # Run a timer and save it to a file |
|---|
| 3 | # This allows for isolation testing of einotebook without |
|---|
| 4 | # Sim Mgr having to run. |
|---|
| 5 | import time |
|---|
| 6 | from datetime import timedelta |
|---|
| 7 | print "Starting elapsed timer ..." |
|---|
| 8 | count = 0 |
|---|
| 9 | while True: |
|---|
| 10 | # Code executed here |
|---|
| 11 | time.sleep(1) |
|---|
| 12 | count += 1 |
|---|
| 13 | # elapsedTime = timedelta(seconds=count) |
|---|
| 14 | # convert integer into hh:mm:ss format |
|---|
| 15 | lineout = "{\"elapsedtime\":\"" + str(count) + "\"}" |
|---|
| 16 | |
|---|
| 17 | # write message to file |
|---|
| 18 | text_file = open("dynamicdata/sim_elapsedtime.json", "w") |
|---|
| 19 | text_file.write(lineout) |
|---|
| 20 | text_file.close() |
|---|
| 21 | |
|---|
| 22 | # print count |
|---|
| 23 | |
|---|
| 24 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.