From 36120fbd7d9bb7771e61bc21d73168bf5d83419e Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 15 Jul 2016 13:49:20 +0200 Subject: [PATCH] Always use German time zone, even if system time zone is different The 1C4A hash is computed based (among other things) the current German time. Let's use German time no matter which timezone the executing system is using. --- inema/inema.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/inema/inema.py b/inema/inema.py index e5f06b1..2e2704c 100644 --- a/inema/inema.py +++ b/inema/inema.py @@ -1,6 +1,7 @@ #!/usr/bin/python -import time +from datetime import datetime +from pytz import timezone import md5 import json from lxml import etree @@ -32,7 +33,9 @@ def gen_1c4a_hdr(partner_id, key_phase, key): return md5_hex[:8] def gen_timestamp(): - return time.strftime("%d%m%Y-%H%M%S") + de_zone = timezone("Europe/Berlin") + de_time = datetime.now(de_zone) + return de_time.strftime("%d%m%Y-%H%M%S") nsmap={'soapenv': 'http://schemas.xmlsoap.org/soap/envelope/', 'v3':'http://oneclickforpartner.dpag.de'}