Browse Source

Move get_asctime function to childutils (from un-checked-in eventloop script).

Chris McDonough 18 năm trước cách đây
mục cha
commit
456b4272c9
1 tập tin đã thay đổi với 9 bổ sung0 xóa
  1. 9 0
      src/supervisor/childutils.py

+ 9 - 0
src/supervisor/childutils.py

@@ -13,6 +13,7 @@
 ##############################################################################
 
 import sys
+import time
 import xmlrpclib
 from supervisor.xmlrpc import SupervisorTransport
 
@@ -37,3 +38,11 @@ def write_stdout(msg):
 
 def get_headers(line):
     return dict([ x.split(':') for x in line.split() ])
+
+def get_asctime():
+    now = time.time()
+    msecs = (now - long(now)) * 1000
+    part1 = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(now))
+    asctime = '%s,%03d' % (part1, msecs)
+    return asctime
+