CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 matplotRender.matplotRender.drawInteractive(), BeamSpotWorkflow.main(), python.timeUnitHelper.packToString(), L1MuGMTLFDeltaEtaLUT.TheLookupFunction(), and L1MuGMTLFCOUDeltaEtaLUT.TheLookupFunction().

3 
4 def pack(high,low):
5  """pack high,low 32bit unsigned int to one unsigned 64bit long long
6  Note:the print value of result number may appear signed, if the sign bit is used.
7  """
8  h=high<<32
9  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.

References python.timeUnitHelper.pack().

10 
11 def packToString(high,low):
12  """pack high,low 32bit unsigned int to one unsigned 64bit long long in string format
13  Note:the print value of result number may appear signed, if the sign bit is used.
14  """
15  fmt="%u"
16  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.

References python.timeUnitHelper.unpack().

29 
30 def timeStamptoDate(i):
31  """convert 64bit timestamp to local date in string format
32  """
33  import time
34  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.

References python.timeUnitHelper.unpack().

35 
36 def timeStamptoUTC(i):
37  """convert 64bit timestamp to Universal Time in string format
38  """
39  t=unpack(i)[0]
40  import time
41  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.

References mathSSE.return().

Referenced by python.timeUnitHelper.timeStamptoDate(), python.timeUnitHelper.timeStamptoUTC(), CSCSPEvent.unpack(), CSCTFEvent.unpack(), python.timeUnitHelper.unpackFromString(), and python.timeUnitHelper.unpackLumiid().

17 
18 def unpack(i):
19  """unpack 64bit unsigned long long into 2 32bit unsigned int, return tuple (high,low)
20  """
21  high=i>>32
22  low=i&0xFFFFFFFF
23  return(high,low)
return((rh^lh)&mask)
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.

References python.timeUnitHelper.unpack().

24 
25 def unpackFromString(i):
26  """unpack 64bit unsigned long long in string format into 2 32bit unsigned int, return tuple(high,low)
27  """
28  return unpack(int(i))
def python.timeUnitHelper.unpackLumiid (   i)
unpack 64bit lumiid to dictionary {'run','lumisection'}

Definition at line 42 of file timeUnitHelper.py.

References python.timeUnitHelper.unpack().

Referenced by uploader.main(), and BeamSpotWorkflow.main().

42 
43 def unpackLumiid(i):
44  """unpack 64bit lumiid to dictionary {'run','lumisection'}
45  """
46  j=unpack(i)
47  return {'run':j[0],'lumisection':j[1]}