From be86feba38250988ca9d0c026e29708503f9e189 Mon Sep 17 00:00:00 2001 From: Zhongyue Luo Date: Sun, 10 Jun 2012 18:42:18 +0800 Subject: Fix utcnow_ts to return UTC timestamp Fixes bug #1011121 Use calendar.timegm instead of time.mktime Change-Id: Idb8d470f1ef90162641d21122699a026fa38faf1 --- openstack/common/timeutils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'openstack') diff --git a/openstack/common/timeutils.py b/openstack/common/timeutils.py index a7b2ce3..5eeaf70 100644 --- a/openstack/common/timeutils.py +++ b/openstack/common/timeutils.py @@ -19,6 +19,7 @@ Time related utilities and helper functions. """ +import calendar import datetime import time @@ -74,7 +75,7 @@ def is_older_than(before, seconds): def utcnow_ts(): """Timestamp version of our utcnow function.""" - return time.mktime(utcnow().timetuple()) + return calendar.timegm(utcnow().timetuple()) def utcnow(): -- cgit