Merge "Remove iso8601_from_timestamp"

This commit is contained in:
Jenkins 2017-09-27 00:26:42 +00:00 committed by Gerrit Code Review
commit d975485a15
3 changed files with 10 additions and 5 deletions

View File

@ -133,11 +133,12 @@ def stat_message(message, now):
msg_id = message['id']
created = oid_ts(to_oid(msg_id))
age = now - created
created_iso = datetime.datetime.utcfromtimestamp(created).strftime(
'%Y-%m-%dT%H:%M:%SZ')
return {
'id': msg_id,
'age': int(age),
'created': timeutils.iso8601_from_timestamp(created),
'created': created_iso,
}

View File

@ -14,12 +14,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import datetime
import functools
import uuid
import msgpack
from oslo_utils import encodeutils
from oslo_utils import timeutils
from oslo_utils import uuidutils
MSGENV_FIELD_KEYS = (b'id', b't', b'cr', b'e', b'u', b'c', b'c.e', b'c.c')
@ -232,7 +232,8 @@ class Message(MessageEnvelope):
}
if include_created:
created_iso = timeutils.iso8601_from_timestamp(self.created)
created_iso = datetime.datetime.utcfromtimestamp(
self.created).strftime('%Y-%m-%dT%H:%M:%SZ')
basic_msg['created'] = created_iso
return basic_msg

View File

@ -12,6 +12,7 @@
# limitations under the License.
import copy
import datetime
import functools
import uuid
@ -341,10 +342,12 @@ class MessageQueueHandler(object):
raise
else:
created = float(headers['x-timestamp'])
created_iso = datetime.datetime.utcfromtimestamp(
created).strftime('%Y-%m-%dT%H:%M:%SZ')
newest = {
'id': obj['name'],
'age': now - created,
'created': timeutils.iso8601_from_timestamp(created)}
'created': created_iso}
if oldest is None:
oldest = copy.deepcopy(newest)
total += 1