CMS 3D CMS Logo

Functions | Variables
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)
 

Variables

string datetime_string_fmt = '%Y-%m-%d %H:%M:%S.%f'
 

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 
def from_lumi_time(lumiTime)
Definition: conddb_time.py:8

◆ from_timestamp()

def conddb_time.from_timestamp (   ts)

Definition at line 19 of file conddb_time.py.

References createfilelist.int.

Referenced by string_from_timestamp().

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 
def from_timestamp(ts)
Definition: conddb_time.py:19

◆ string_from_timestamp()

def conddb_time.string_from_timestamp (   ts)

Definition at line 29 of file conddb_time.py.

References from_timestamp().

29 def string_from_timestamp( ts ):
30  dt = from_timestamp( ts )
31  return dt.strftime( datetime_string_fmt )
32 
33 
34 
def string_from_timestamp(ts)
Definition: conddb_time.py:29
def from_timestamp(ts)
Definition: conddb_time.py:19

◆ string_to_timestamp()

def conddb_time.string_to_timestamp (   sdt)

Definition at line 25 of file conddb_time.py.

References to_timestamp().

Referenced by conddb_version_mgr.version_db.insert_boost_run_range().

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

◆ 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 
def to_lumi_time(runNumber, lumiSectionId)
Definition: conddb_time.py:5

◆ to_timestamp()

def conddb_time.to_timestamp (   dt)

Definition at line 13 of file conddb_time.py.

References createfilelist.int.

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

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 
def to_timestamp(dt)
Definition: conddb_time.py:13

Variable Documentation

◆ datetime_string_fmt

string conddb_time.datetime_string_fmt = '%Y-%m-%d %H:%M:%S.%f'

Definition at line 3 of file conddb_time.py.