From bbf977a501add31a8eba211d65a8f4c1b9fe0e04 Mon Sep 17 00:00:00 2001 From: Michael Dong Date: Thu, 14 Jul 2016 14:06:58 -0700 Subject: [PATCH] timestamp parsed into utc instead of localtime(which was default) Closes Bug:#160531 Change-Id: I74454eda759af5dfaf33b58b4ea18142350129b0 --- monasca_transform/component/setter/rollup_quantity.py | 4 ++-- monasca_transform/component/usage/fetch_quantity.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/monasca_transform/component/setter/rollup_quantity.py b/monasca_transform/component/setter/rollup_quantity.py index 21ac92b..4f8c48f 100644 --- a/monasca_transform/component/setter/rollup_quantity.py +++ b/monasca_transform/component/setter/rollup_quantity.py @@ -83,7 +83,7 @@ class RollupQuantity(SetterComponent): row, "min(firstrecord_timestamp_unix)", Component.DEFAULT_UNAVAILABLE_VALUE) earliest_record_timestamp_string = \ - datetime.datetime.fromtimestamp( + datetime.datetime.utcfromtimestamp( earliest_record_timestamp_unix).strftime( '%Y-%m-%d %H:%M:%S') @@ -92,7 +92,7 @@ class RollupQuantity(SetterComponent): row, "max(lastrecord_timestamp_unix)", Component.DEFAULT_UNAVAILABLE_VALUE) latest_record_timestamp_string = \ - datetime.datetime.fromtimestamp( + datetime.datetime.utcfromtimestamp( latest_record_timestamp_unix).strftime('%Y-%m-%d %H:%M:%S') # record count diff --git a/monasca_transform/component/usage/fetch_quantity.py b/monasca_transform/component/usage/fetch_quantity.py index 0a33ad3..847992b 100644 --- a/monasca_transform/component/usage/fetch_quantity.py +++ b/monasca_transform/component/usage/fetch_quantity.py @@ -184,7 +184,7 @@ class FetchQuantity(UsageComponent): row, "min(event_timestamp_unix_for_min)", Component.DEFAULT_UNAVAILABLE_VALUE) earliest_record_timestamp_string = \ - datetime.datetime.fromtimestamp( + datetime.datetime.utcfromtimestamp( earliest_record_timestamp_unix).strftime( '%Y-%m-%d %H:%M:%S') @@ -193,7 +193,7 @@ class FetchQuantity(UsageComponent): row, "max(event_timestamp_unix_for_max)", Component.DEFAULT_UNAVAILABLE_VALUE) latest_record_timestamp_string = \ - datetime.datetime.fromtimestamp( + datetime.datetime.utcfromtimestamp( latest_record_timestamp_unix).strftime('%Y-%m-%d %H:%M:%S') # record count