]> git.phdru.name Git - m_lib.git/blob - m_lib/clock/mkclock.py
Remove wrong copyright lines, fix module docstrings
[m_lib.git] / m_lib / clock / mkclock.py
1 #! /usr/bin/env python
2 """Test if current interpreter do not have clock() and define it as need"""
3
4 import sys, time
5
6 print "Testing...",
7 sys.stdout.flush()
8
9 time.sleep(3)
10 print '\n' + " "*len("Testing...") + '\n',
11
12 need_clock = time.clock() <> 3
13
14 outfile = open("clock.py", 'w')
15
16 if need_clock:
17    print "Generaing clock.py with custom clock()"
18    outfile.write("""\"\"\"
19    Define clock() for systems that do not have it
20 \"\"\"
21
22 from time import time
23 _clock = time()
24
25 def clock():
26    return int(time() - _clock)
27 """)
28 else:
29    print "Generaing clock.py with standard clock()"
30    outfile.write("""\"\"\"
31    Define clock() shim
32 \"\"\"
33
34 from time import clock
35    """)