Mon, Sep 14, 2015 at 08:26:40AM EDT, jprochaz(a)redhat.com wrote:
2015-09-14 14:05 GMT+02:00 <olichtne(a)redhat.com>:
> From: Ondrej Lichtner <olichtne(a)redhat.com>
>
> People from different time zones can use the same PerfRepo instance,
> automatically using UTC time stamps will avoid incorrect sorting of
> results (by date).
>
> Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
> ---
> lnst/Controller/PerfRepo.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lnst/Controller/PerfRepo.py b/lnst/Controller/PerfRepo.py
> index e244321..4418902 100644
> --- a/lnst/Controller/PerfRepo.py
> +++ b/lnst/Controller/PerfRepo.py
> @@ -121,7 +121,7 @@ class PerfRepoTestExecution(PerfRepoObject):
> if type(xml) is NoneType:
> self._id = None
> self._name = None
> - self._started = datetime.datetime.now().isoformat()
> + self._started = datetime.datetime.utcnow().isoformat()
> self._testId = None
> self._testUid = None
> self._comment = ""
> @@ -173,7 +173,7 @@ class PerfRepoTestExecution(PerfRepoObject):
>
> def set_started(self, date=None):
> if isinstance(date, NoneType):
> - date = datetime.datetime.now()
> + date = datetime.datetime.utcnow().isoformat()
> self._started = date.isoformat()
>
isoformat() returns type str, so execution fails on AttributeError
exception
Either don't call isoformat() on line with utcnow() or on the line below
Hmm, I don't see that problem on my setup. With which python version do
you see that?
Python 2.7.8 (default, Jul 5 2015, 14:16:16)
[GCC 4.9.2 20150212 (Red Hat 4.9.2-6)] on linux2
Type "help", "copyright", "credits" or "license"
for more information.
>> import datetime
>> a = datetime.datetime.now().isoformat()
>> b = datetime.datetime.utcnow().isoformat()
>> a
'2015-09-14T22:06:13.488851'
>> b
'2015-09-15T02:06:20.313035'
> else:
> self._started = date
> --
> 2.5.2
>
> _______________________________________________
> LNST-developers mailing list
> LNST-developers(a)lists.fedorahosted.org
>
https://lists.fedorahosted.org/mailman/listinfo/lnst-developers
>
--
Best regards,
Jiri Prochazka
LNST Developer
|
www.lnst-project.org
+420 532 294 633 | jprochaz(a)redhat.com
Red Hat Czech | Purkyňova 71/99, 612 00 Brno
_______________________________________________
LNST-developers mailing list
LNST-developers(a)lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/lnst-developers