From be0d28045aff369ef854b06bbdfa41a5ce4ef904 Mon Sep 17 00:00:00 2001 From: Joris De Winne Date: Fri, 5 Apr 2019 08:39:11 -0700 Subject: [PATCH] Using dateutil to parse tc timestamps --- src/main/resources/teamcity/BuildConfigurationsStatusTile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/teamcity/BuildConfigurationsStatusTile.py b/src/main/resources/teamcity/BuildConfigurationsStatusTile.py index 9d66180..20bc6c4 100644 --- a/src/main/resources/teamcity/BuildConfigurationsStatusTile.py +++ b/src/main/resources/teamcity/BuildConfigurationsStatusTile.py @@ -9,8 +9,8 @@ # import logging -import time +from dateutil.parser import parse from teamcity import TeamCityClient logger = logging.getLogger("TeamCity") @@ -62,7 +62,7 @@ build_test_occurrences["failureCount"] = failureCount project_status["statuses"].append({"name": build_configuration['name'], "status": build_configuration['builds']['build'][0]['status'], "statusText": build_configuration['builds']['build'][0]['statusText'], - "finishDate": time.strftime("%a, %d %b %Y %H:%M:%S", time.strptime(build_configuration['builds']['build'][0]['finishDate'], "%Y%m%dT%H%M%S+0000")), + "finishDate": parse(build_configuration['builds']['build'][0]['finishDate']).strftime("%a, %d %b %Y %H:%M:%S"), "problemOccurrences": build_problem_occurrences, "testOccurrences": build_test_occurrences, "buildLog": processed_build_log, "statusUrl": "%s/app/rest/builds/buildType:(id:%s)/statusIcon" % (teamcityServer["url"], build_configuration['id']),