ATLAS Offline Software
Loading...
Searching...
No Matches
python.sugar.runlumi.TimestampType Class Reference
Inheritance diagram for python.sugar.runlumi.TimestampType:
Collaboration diagram for python.sugar.runlumi.TimestampType:

Public Member Functions

 __repr__ (self)
 __str__ (self)
 date (self)
 from_date (cls, date)
 from_string (cls, date_string)

Public Attributes

 date

Static Public Attributes

bool is_time = True

Static Private Attributes

tuple __slots__ = ()

Detailed Description

Definition at line 90 of file runlumi.py.

Member Function Documentation

◆ __repr__()

python.sugar.runlumi.TimestampType.__repr__ ( self)

Definition at line 94 of file runlumi.py.

94 def __repr__(self):
95 return str(self.date) + " UTC"
96

◆ __str__()

python.sugar.runlumi.TimestampType.__str__ ( self)

Definition at line 97 of file runlumi.py.

97 def __str__(self):
98 return self.__repr__()
99

◆ date()

python.sugar.runlumi.TimestampType.date ( self)

Definition at line 101 of file runlumi.py.

101 def date(self):
102 if self == IOV_MAX:
103 return "([MAX]:[MAX])"
104 try:
105 return date_from_timestamp(self/1e9)
106 except ValueError:
107 return "[InvalidDate]"
108
std::string date()
sadly, includes a return at the end
Definition hcg.cxx:58

◆ from_date()

python.sugar.runlumi.TimestampType.from_date ( cls,
date )

Definition at line 110 of file runlumi.py.

110 def from_date(cls, date):
111 return cls((timegm(date.utctimetuple()) * 1000000000)
112 + 1000*date.microsecond)
113

◆ from_string()

python.sugar.runlumi.TimestampType.from_string ( cls,
date_string )
Create a TimestampType IOVKey from a %d/%m/%Y string or %H:%M:%S

Definition at line 115 of file runlumi.py.

115 def from_string(cls, date_string):
116 """
117 Create a TimestampType IOVKey from a %d/%m/%Y string or %H:%M:%S
118 """
119 try:
120 d = datetime.strptime(date_string, "%d/%m/%Y")
121 except ValueError:
122 try:
123 d = datetime.strptime(date_string, "%d/%m/%Y %H:%M:%S")
124 except ValueError:
125 log.exception("Invalid")
126 raise
127
128 return cls.from_date(d)

Member Data Documentation

◆ __slots__

tuple python.sugar.runlumi.TimestampType.__slots__ = ()
staticprivate

Definition at line 91 of file runlumi.py.

◆ date

python.sugar.runlumi.TimestampType.date

Definition at line 95 of file runlumi.py.

◆ is_time

bool python.sugar.runlumi.TimestampType.is_time = True
static

Definition at line 92 of file runlumi.py.


The documentation for this class was generated from the following file: