Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-25 02:29:11

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