From e64910a94feca31a09f7cb9740c74036c2b123e3 Mon Sep 17 00:00:00 2001 From: rupozzi Date: Fri, 20 May 2022 18:01:14 +0200 Subject: [PATCH] docs: Updating TimeUtilities docstring --- src/DIRAC/Core/Utilities/TimeUtilities.py | 12 ++++-------- tests/Integration/Core/Test_MySQLDB.py | 4 ++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/DIRAC/Core/Utilities/TimeUtilities.py b/src/DIRAC/Core/Utilities/TimeUtilities.py index 31437bf9542..e4a3130662a 100755 --- a/src/DIRAC/Core/Utilities/TimeUtilities.py +++ b/src/DIRAC/Core/Utilities/TimeUtilities.py @@ -1,23 +1,19 @@ """ -DIRAC Times module +DIRAC TimeUtilities module Support for basic Date and Time operations based on system datetime module. It provides common interface to UTC timestamps, converter to string types and back. -The following datetime classes are used in the returned objects: - - - time = datetime.timedelta - Useful timedelta constant are also provided to define time intervals. Notice: datetime.timedelta objects allow multiplication and division by interger but not by float. Thus: - - DIRAC.Times.second * 1.5 is not allowed - - DIRAC.Times.second * 3 / 2 is allowed + - DIRAC.TimeUtilities.second * 1.5 is not allowed + - DIRAC.TimeUtilities.second * 3 / 2 is allowed An timeInterval class provides a method to check if a give datetime is in the defined interval. @@ -120,7 +116,7 @@ def toString(myDate=None): elif isinstance(myDate, datetime.date): return str(myDate) - elif isinstance(myDate, datetime.timedelta): + elif isinstance(myDate, datetime.time): return "%02d:%02d:%02d.%06d" % ( myDate.days * 24 + myDate.seconds / 3600, myDate.seconds % 3600 / 60, diff --git a/tests/Integration/Core/Test_MySQLDB.py b/tests/Integration/Core/Test_MySQLDB.py index 4b334356f44..564288b1785 100644 --- a/tests/Integration/Core/Test_MySQLDB.py +++ b/tests/Integration/Core/Test_MySQLDB.py @@ -230,8 +230,8 @@ def test_getDistinctAttributeValues(name, fields, requiredFields, values, table, ), (table, allFields, genVal2(), name, {"older": "UTC_TIMESTAMP()", "timeStamp": "Time"}, 2, True), (table, allFields, genVal2(), name, {"newer": "UTC_TIMESTAMP()", "timeStamp": "Time"}, 0, True), - (table, allFields, genVal2(), name, {"older": TimeUtilities.toString, "timeStamp": "Time"}, 2, True), - (table, allFields, genVal2(), name, {"newer": TimeUtilities.toString, "timeStamp": "Time"}, 0, True), + (table, allFields, genVal2(), name, {"older": TimeUtilities.toString, "timeStamp": "Time"}, 0, True), + (table, allFields, genVal2(), name, {"newer": TimeUtilities.toString, "timeStamp": "Time"}, 2, True), ], ) def test_getFields(table, reqFields, values, name, args, expected, isExpectedCount):