source: tmcsimulator/trunk/webapps/einotebook/spikes/runTimer.py @ 375

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.
5import time
6from datetime import timedelta
7print "Starting elapsed timer ..."
8count = 0
9while 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.