CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions | Variables
conddb_time Namespace Reference

Functions

def from_lumi_time
 
def from_timestamp
 
def string_from_timestamp
 
def string_to_timestamp
 
def to_lumi_time
 
def to_timestamp
 

Variables

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

Function Documentation

def conddb_time.from_lumi_time (   lumiTime)

Definition at line 8 of file conddb_time.py.

8 
9 def from_lumi_time( lumiTime ):
10  run = lumiTime>>32
11  lumisection_id = lumiTime-( run << 32 )
12  return run, lumisection_id
def from_lumi_time
Definition: conddb_time.py:8
def conddb_time.from_timestamp (   ts)

Definition at line 19 of file conddb_time.py.

Referenced by string_from_timestamp().

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

Definition at line 29 of file conddb_time.py.

References from_timestamp().

29 
30 def string_from_timestamp( ts ):
31  dt = from_timestamp( ts )
32  return dt.strftime( datetime_string_fmt )
33 
34 
def string_from_timestamp
Definition: conddb_time.py:29
def from_timestamp
Definition: conddb_time.py:19
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 
26 def string_to_timestamp( sdt ):
27  dt = datetime.datetime.strptime( sdt, datetime_string_fmt )
28  return to_timestamp( dt )
def string_to_timestamp
Definition: conddb_time.py:25
def to_timestamp
Definition: conddb_time.py:13
def conddb_time.to_lumi_time (   runNumber,
  lumiSectionId 
)

Definition at line 5 of file conddb_time.py.

5 
6 def to_lumi_time( runNumber, lumiSectionId ):
7  return (runNumber<<32) + lumiSectionId
def to_lumi_time
Definition: conddb_time.py:5
def conddb_time.to_timestamp (   dt)

Definition at line 13 of file conddb_time.py.

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

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

Variable Documentation

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

Definition at line 3 of file conddb_time.py.