| Revision 348,
468 bytes
checked in by jdalbey, 7 years ago
(diff) |
|
Added gotoxmltime.html and other prototypes for ei notebook. They can be removed when no longer needed.
|
-
Property svn:executable set to
*
|
| Line | |
|---|
| 1 | #!/usr/bin/python |
|---|
| 2 | # Run a timer and save it to a file |
|---|
| 3 | import time |
|---|
| 4 | from datetime import timedelta |
|---|
| 5 | count = 0 |
|---|
| 6 | while True: |
|---|
| 7 | # Code executed here |
|---|
| 8 | time.sleep(1) |
|---|
| 9 | count += 1 |
|---|
| 10 | elapsedTime = timedelta(seconds=count) |
|---|
| 11 | # convert integer into hh:mm:ss format |
|---|
| 12 | lineout = "{\"clock\":\"" + str(elapsedTime) + "\"}" |
|---|
| 13 | |
|---|
| 14 | # write message to file |
|---|
| 15 | text_file = open("sim_clock.json", "w") |
|---|
| 16 | text_file.write(lineout) |
|---|
| 17 | text_file.close() |
|---|
| 18 | |
|---|
| 19 | print count |
|---|
| 20 | |
|---|
| 21 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.