CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
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 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 CmsShowMainFrame.getSummaryViewWeight(), BeamSpotWorkflow.main(), packToString(), CmsShowMainFrame.setSummaryViewWeight(), 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 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 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 timeUnitHelper.timeStamptoDate (   i)
convert 64bit timestamp to local date in string format

Definition at line 29 of file timeUnitHelper.py.

References 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 timeUnitHelper.timeStamptoUTC (   i)
convert 64bit timestamp to Universal Time in string format

Definition at line 35 of file timeUnitHelper.py.

References 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 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 pat::PackedGenParticle.dxy(), pat::PackedGenParticle.dz(), pat::PackedCandidate.pack(), TreeCrawler.mymf.scan_opcodes_25(), timeStamptoDate(), timeStamptoUTC(), CSCSPEvent.unpack(), CSCTFEvent.unpack(), unpackFromString(), and 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 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 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 timeUnitHelper.unpackLumiid (   i)
unpack 64bit lumiid to dictionary {'run','lumisection'}

Definition at line 42 of file timeUnitHelper.py.

References 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]}