[Getan-commits] [PATCH] human_time calculates up to 59 minutes, not 60

Wald Commits scm-commit at wald.intevation.org
Tue Nov 6 13:01:16 CET 2018


# HG changeset patch
# User Magnus Schieder <mschieder at intevation.de>
# Date 1541505668 -3600
# Node ID 31ea48bf8a7c0b2014940790ab2231bd6a6befee
# Parent  8c7a00a984daccb54ed1de456689601faa71c22d
human_time calculates up to 59 minutes, not 60.

 * Porting the human_time function from Python2 to Python3.
   Minutes and hours must be integer.

diff -r 8c7a00a984da -r 31ea48bf8a7c getan/template.py
--- a/getan/template.py	Fri Nov 02 15:51:16 2018 +0100
+++ b/getan/template.py	Tue Nov 06 13:01:08 2018 +0100
@@ -23,8 +23,8 @@
     days = delta.days
     seconds = days * 3600 * 24
     s = seconds + delta.seconds
-    h = s / 3600
-    m = (s % 3600) / 60
+    h = s // 3600
+    m = (s % 3600) // 60
     if (s % 60) >= 30:
         m += 1
         if m == 60:


More information about the Getan-commits mailing list