Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:59:50

0001 from __future__ import print_function
0002 def pack(high,low):
0003     """pack high,low 32bit unsigned int to one unsigned 64bit long long
0004        Note:the print value of result number may appear signed, if the sign bit is used.
0005     """
0006     h=high<<32
0007     return (h|low)
0008 
0009 def secondsFromString(i):
0010     """convert from a string in the format output from timeStamptoDate to a 32bit seconds from the epoch.
0011     The format accepted is \"DD/MM/YYYY HH:MM:SS\". The year must be the full number.
0012     """
0013     import time
0014     return int(time.mktime(time.strptime(i, "%d/%m/%Y %H:%M:%S")))
0015 
0016 def packFromString(i):
0017     """pack from a string in the format output from timeStamptoUTC to a 64bit timestamp
0018     the format accepted is \"DD/MM/YYYY HH:MM:SS\" . The year must be the full number.
0019     """
0020     return pack(secondsFromString(i), 0)
0021 
0022 def intervalSinceEpoch(i):
0023     """ compute the interval of time in seconds since the Epoch and return the packed 64bit value.
0024     """
0025     return( packFromString(i) - packFromString("01/01/1970 00:00:00") )
0026 
0027 def unpack(i):
0028     """unpack 64bit unsigned long long into 2 32bit unsigned int, return tuple (high,low)
0029     """
0030     high=i>>32
0031     low=i&0xFFFFFFFF
0032     return(high,low)
0033 
0034 def timeStamptoDate(i):
0035     """convert 64bit timestamp to local date in string format
0036     """
0037     import time
0038     return time.ctime(unpack(i)[0])
0039 
0040 import os
0041 import re
0042 import sys
0043 
0044 time = timeStamptoDate(long(sys.argv[1]))
0045 print(time)
0046