CMS 3D CMS Logo

Functions

python::timeUnitHelper Namespace Reference

Functions

def pack
def packToString
def timeStamptoDate
def timeStamptoUTC
def unpack
def unpackFromString
def unpackLumiid

Detailed Description

Some helper classes to convert conditions time units back and forth

Function Documentation

def python::timeUnitHelper::pack (   high,
  low 
)
pack high,low 32bit unsigned int to one unsigned 64bit long long
   Note:the print value of result number may appear signed, if the sign bit is used.

Definition at line 3 of file timeUnitHelper.py.

Referenced by L1MuGMTLFDeltaEtaLUT::TheLookupFunction(), and L1MuGMTLFCOUDeltaEtaLUT::TheLookupFunction().

00004                   :
00005     """pack high,low 32bit unsigned int to one unsigned 64bit long long
00006        Note:the print value of result number may appear signed, if the sign bit is used.
00007     """
00008     h=high<<32
00009     return (h|low)

def python::timeUnitHelper::packToString (   high,
  low 
)
pack high,low 32bit unsigned int to one unsigned 64bit long long in string format
   Note:the print value of result number may appear signed, if the sign bit is used.

Definition at line 10 of file timeUnitHelper.py.

00011                           :
00012     """pack high,low 32bit unsigned int to one unsigned 64bit long long in string format
00013        Note:the print value of result number may appear signed, if the sign bit is used.
00014     """
00015     fmt="%u"
00016     return fmt%pack(high,low)

def python::timeUnitHelper::timeStamptoDate (   i)
convert 64bit timestamp to local date in string format

Definition at line 29 of file timeUnitHelper.py.

00030                       :
00031     """convert 64bit timestamp to local date in string format
00032     """
00033     import time
00034     return time.ctime(unpack(i)[0])

def python::timeUnitHelper::timeStamptoUTC (   i)
convert 64bit timestamp to Universal Time in string format

Definition at line 35 of file timeUnitHelper.py.

00036                      :
00037     """convert 64bit timestamp to Universal Time in string format
00038     """
00039     t=unpack(i)[0]
00040     import time
00041     return time.strftime("%a, %d %b %Y %H:%M:%S +0000",time.gmtime(t))
                         
def python::timeUnitHelper::unpack (   i)
unpack 64bit unsigned long long into 2 32bit unsigned int, return tuple (high,low)

Definition at line 17 of file timeUnitHelper.py.

Referenced by CSCTFEvent::unpack(), and CSCSPEvent::unpack().

00018              :
00019     """unpack 64bit unsigned long long into 2 32bit unsigned int, return tuple (high,low)
00020     """
00021     high=i>>32
00022     low=i&0xFFFFFFFF
00023     return(high,low)

def python::timeUnitHelper::unpackFromString (   i)
unpack 64bit unsigned long long in string format into 2 32bit unsigned int, return tuple(high,low)

Definition at line 24 of file timeUnitHelper.py.

00025                        :
00026     """unpack 64bit unsigned long long in string format into 2 32bit unsigned int, return tuple(high,low)
00027     """
00028     return unpack(int(i))

def python::timeUnitHelper::unpackLumiid (   i)
unpack 64bit lumiid to dictionary {'run','lumisection'}

Definition at line 42 of file timeUnitHelper.py.

00043                    :
00044     """unpack 64bit lumiid to dictionary {'run','lumisection'}
00045     """
00046     j=unpack(i)
00047     return {'run':j[0],'lumisection':j[1]}