Merge "Remove unused method iso8601_from_timestamp"
This commit is contained in:
commit
e939f17ed4
@ -17,8 +17,6 @@
|
||||
Time related utilities and helper functions.
|
||||
"""
|
||||
|
||||
import datetime
|
||||
|
||||
from oslo_utils import timeutils
|
||||
|
||||
# ISO 8601 extended time format with microseconds
|
||||
@ -38,9 +36,3 @@ def isotime(at=None, subsecond=False):
|
||||
# Need to handle either iso8601 or python UTC format
|
||||
st += ('Z' if tz in ['UTC', 'UTC+00:00'] else tz)
|
||||
return st
|
||||
|
||||
|
||||
def iso8601_from_timestamp(timestamp, microsecond=False):
|
||||
"""Returns an iso8601 formatted date from timestamp."""
|
||||
return isotime(datetime.datetime.fromtimestamp(
|
||||
timestamp, tz=datetime.timezone.utc).replace(tzinfo=None), microsecond)
|
||||
|
@ -13,12 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import calendar
|
||||
import datetime
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import timeutils as oslo_timeutils
|
||||
|
||||
from glance.common import timeutils
|
||||
from glance.tests import utils as test_utils
|
||||
|
||||
@ -49,9 +46,3 @@ class TimeUtilsTest(test_utils.BaseTestCase):
|
||||
utcnow_mock.return_value = self.skynet_self_aware_ms_time
|
||||
dt = timeutils.isotime(subsecond=True)
|
||||
self.assertEqual(dt, self.skynet_self_aware_time_ms_str)
|
||||
|
||||
def test_iso8601_from_timestamp(self):
|
||||
utcnow = oslo_timeutils.utcnow()
|
||||
iso = timeutils.isotime(utcnow)
|
||||
ts = calendar.timegm(utcnow.timetuple())
|
||||
self.assertEqual(iso, timeutils.iso8601_from_timestamp(ts))
|
||||
|
Loading…
x
Reference in New Issue
Block a user