1
2
3
4
5
6
7
8
9
10
11
12
13
14 """Time
15
16 Utilities for consistent manipulation of Dates and Time. All simple
17 code should migrate here, and without dependencies on anything other
18 than standard python libraries.
19
20 $Id:$"""
21
22 __version__ = "$$"[11:-2]
23
24 import time
25
27 if gmtSecondsSince1970 is None:
28 return time.time()
29 return int(gmtSecondsSince1970)
30
35
39
43
44 -def USDate(gmtSecondsSince1970 = None):
47
49 return time.mktime(time.strptime(mdy, "%m/%d/%Y"))
50
54
55 -def HHMMSS(gmtSecondsSince1970 = None):
58
60 return "Saved at time: " + HHMMSS()
61
63 result = ':%02d' % (seconds % 60)
64 seconds /= 60
65 if seconds:
66 result = '%02d%s' % (seconds % 60, result)
67 seconds /= 60
68 if seconds:
69 result = '%02d:%s' % (seconds % 24, result)
70 seconds /= 24
71 if seconds:
72 result = '%d days %s' % (seconds, result)
73 return result
74