[ARVADOS] updated: 1.1.4-366-g7d7eb76
Git user
git at public.curoverse.com
Thu Jun 7 15:30:56 EDT 2018
Summary of changes:
sdk/cwl/arvados_cwl/http.py | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
via 7d7eb76d319f1ab6faeb8634f13142e7147a45ea (commit)
from e3483661acc3d26d4532a536bd40ed761c21d7d1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 7d7eb76d319f1ab6faeb8634f13142e7147a45ea
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date: Thu Jun 7 15:26:36 2018 -0400
11907: Fix timezone handling for HTTP timestamps.
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
diff --git a/sdk/cwl/arvados_cwl/http.py b/sdk/cwl/arvados_cwl/http.py
index 32fc1cf..4516de0 100644
--- a/sdk/cwl/arvados_cwl/http.py
+++ b/sdk/cwl/arvados_cwl/http.py
@@ -1,3 +1,7 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+
import requests
import email.utils
import time
@@ -7,17 +11,23 @@ import arvados
import arvados.collection
import urlparse
import logging
+import calendar
logger = logging.getLogger('arvados.cwl-runner')
def my_formatdate(dt):
- return email.utils.formatdate(timeval=time.mktime(dt.timetuple()),
+ return email.utils.formatdate(timeval=calendar.timegm(dt.timetuple()),
localtime=False, usegmt=True)
def my_parsedate(text):
- parsed = email.utils.parsedate(text)
+ parsed = email.utils.parsedate_tz(text)
if parsed:
- return datetime.datetime(*parsed[:6])
+ if parsed[9]:
+ # Adjust to UTC
+ return datetime.datetime(*parsed[:6]) + datetime.timedelta(seconds=parsed[9])
+ else:
+ # TZ is zero or missing, assume UTC.
+ return datetime.datetime(*parsed[:6])
else:
return datetime.datetime(1970, 1, 1)
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list