Skip to content

Commit e64910a

Browse files
committed
docs: Updating TimeUtilities docstring
1 parent 9abc93d commit e64910a

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/DIRAC/Core/Utilities/TimeUtilities.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
"""
2-
DIRAC Times module
2+
DIRAC TimeUtilities module
33
Support for basic Date and Time operations
44
based on system datetime module.
55
66
It provides common interface to UTC timestamps,
77
converter to string types and back.
88
9-
The following datetime classes are used in the returned objects:
10-
11-
- time = datetime.timedelta
12-
139
Useful timedelta constant are also provided to
1410
define time intervals.
1511
1612
Notice: datetime.timedelta objects allow multiplication and division by interger
1713
but not by float. Thus:
1814
19-
- DIRAC.Times.second * 1.5 is not allowed
20-
- DIRAC.Times.second * 3 / 2 is allowed
15+
- DIRAC.TimeUtilities.second * 1.5 is not allowed
16+
- DIRAC.TimeUtilities.second * 3 / 2 is allowed
2117
2218
An timeInterval class provides a method to check
2319
if a give datetime is in the defined interval.
@@ -120,7 +116,7 @@ def toString(myDate=None):
120116
elif isinstance(myDate, datetime.date):
121117
return str(myDate)
122118

123-
elif isinstance(myDate, datetime.timedelta):
119+
elif isinstance(myDate, datetime.time):
124120
return "%02d:%02d:%02d.%06d" % (
125121
myDate.days * 24 + myDate.seconds / 3600,
126122
myDate.seconds % 3600 / 60,

tests/Integration/Core/Test_MySQLDB.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ def test_getDistinctAttributeValues(name, fields, requiredFields, values, table,
230230
),
231231
(table, allFields, genVal2(), name, {"older": "UTC_TIMESTAMP()", "timeStamp": "Time"}, 2, True),
232232
(table, allFields, genVal2(), name, {"newer": "UTC_TIMESTAMP()", "timeStamp": "Time"}, 0, True),
233-
(table, allFields, genVal2(), name, {"older": TimeUtilities.toString, "timeStamp": "Time"}, 2, True),
234-
(table, allFields, genVal2(), name, {"newer": TimeUtilities.toString, "timeStamp": "Time"}, 0, True),
233+
(table, allFields, genVal2(), name, {"older": TimeUtilities.toString, "timeStamp": "Time"}, 0, True),
234+
(table, allFields, genVal2(), name, {"newer": TimeUtilities.toString, "timeStamp": "Time"}, 2, True),
235235
],
236236
)
237237
def test_getFields(table, reqFields, values, name, args, expected, isExpectedCount):

0 commit comments

Comments
 (0)