CMS 3D CMS Logo

Functions
conddb_time Namespace Reference

Functions

def from_lumi_time (lumiTime)
 
def from_timestamp (ts)
 
def string_from_timestamp (ts)
 
def string_to_timestamp (sdt)
 
def to_lumi_time (runNumber, lumiSectionId)
 
def to_timestamp (dt)
 

Function Documentation

◆ from_lumi_time()

def conddb_time.from_lumi_time (   lumiTime)

Definition at line 8 of file conddb_time.py.

8 def from_lumi_time( lumiTime ):
9  run = lumiTime>>32
10  lumisection_id = lumiTime-( run << 32 )
11  return run, lumisection_id
12 

◆ from_timestamp()

def conddb_time.from_timestamp (   ts)

Definition at line 19 of file conddb_time.py.

19 def from_timestamp( ts ):
20  seconds_from_epoch = ts >> 32
21  nanoseconds_from_epoch = ts - ( seconds_from_epoch << 32 )
22  dt = datetime.datetime.utcfromtimestamp(seconds_from_epoch)
23  return dt + datetime.timedelta( microseconds=int(nanoseconds_from_epoch/1000) )
24 

References createfilelist.int.

Referenced by string_from_timestamp().

◆ string_from_timestamp()

def conddb_time.string_from_timestamp (   ts)

Definition at line 29 of file conddb_time.py.

29 def string_from_timestamp( ts ):
30  dt = from_timestamp( ts )
31  return dt.strftime( datetime_string_fmt )
32 
33 

References from_timestamp().

◆ string_to_timestamp()

def conddb_time.string_to_timestamp (   sdt)

Definition at line 25 of file conddb_time.py.

25 def string_to_timestamp( sdt ):
26  dt = datetime.datetime.strptime( sdt, datetime_string_fmt )
27  return to_timestamp( dt )
28 

References to_timestamp().

Referenced by conddb_version_mgr.version_db.insert_boost_run_range().

◆ to_lumi_time()

def conddb_time.to_lumi_time (   runNumber,
  lumiSectionId 
)

Definition at line 5 of file conddb_time.py.

5 def to_lumi_time( runNumber, lumiSectionId ):
6  return (runNumber<<32) + lumiSectionId
7 

◆ to_timestamp()

def conddb_time.to_timestamp (   dt)

Definition at line 13 of file conddb_time.py.

13 def to_timestamp( dt ):
14  timespan_from_epoch = dt - datetime.datetime(1970,1,1)
15  seconds_from_epoch = int( timespan_from_epoch.total_seconds() )
16  nanoseconds_from_epoch = timespan_from_epoch.microseconds * 1000
17  return ( seconds_from_epoch << 32 ) + nanoseconds_from_epoch
18 

References createfilelist.int.

Referenced by uploads.uploader.filter_iovs_by_fcsr(), models.generate(), uploads.log(), uploads.uploader.send_blob(), and string_to_timestamp().

conddb_time.string_from_timestamp
def string_from_timestamp(ts)
Definition: conddb_time.py:29
conddb_time.to_timestamp
def to_timestamp(dt)
Definition: conddb_time.py:13
conddb_time.from_timestamp
def from_timestamp(ts)
Definition: conddb_time.py:19
conddb_time.to_lumi_time
def to_lumi_time(runNumber, lumiSectionId)
Definition: conddb_time.py:5
conddb_time.from_lumi_time
def from_lumi_time(lumiTime)
Definition: conddb_time.py:8
conddb_time.string_to_timestamp
def string_to_timestamp(sdt)
Definition: conddb_time.py:25
createfilelist.int
int
Definition: createfilelist.py:10