Package Products ::
Package ZenUtils ::
Module Time
|
|
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
45 return time.mktime(time.strptime(mdy, "%m/%d/%Y"))
46
50
54
56 return "Saved at time: " + HHMMSS()
57
59 result = ':%02d' % (seconds % 60)
60 seconds /= 60
61 if seconds:
62 result = '%02d%s' % (seconds % 60, result)
63 seconds /= 60
64 if seconds:
65 result = '%02d:%s' % (seconds % 24, result)
66 seconds /= 24
67 if seconds:
68 result = '%d days %s' % (seconds, result)
69 return result
70