Skip to content

Commit 60342fa

Browse files
authored
Merge pull request #1977 from geofabrik/time-no-longer-approximate
Make the display of time intervals show seconds.
2 parents c92ce45 + c3fbb1e commit 60342fa

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

scripts/osm2pgsql-replication

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,25 @@ LOG = logging.getLogger()
5454
OSM2PGSQL_PATH = Path(__file__).parent.resolve() / 'osm2pgsql'
5555

5656
def pretty_format_timedelta(seconds):
57-
minutes = int(seconds/60)
57+
(minutes, seconds) = divmod(seconds, 60)
5858
(hours, minutes) = divmod(minutes, 60)
5959
(days, hours) = divmod(hours, 24)
6060
(weeks, days) = divmod(days, 7)
6161

62-
if 0 < seconds < 60:
63-
output = "<1 minute"
64-
else:
65-
output = []
66-
# If weeks > 1 but hours == 0, we still want to show "0 hours"
67-
if weeks > 0:
68-
output.append("{} week(s)".format(weeks))
69-
if days > 0 or weeks > 0:
70-
output.append("{} day(s)".format(days))
71-
if hours > 0 or days > 0 or weeks > 0:
72-
output.append("{} hour(s)".format(hours))
73-
62+
output = []
63+
# If weeks > 1 but hours == 0, we still want to show "0 hours"
64+
if weeks > 0:
65+
output.append("{} week(s)".format(weeks))
66+
if days > 0 or weeks > 0:
67+
output.append("{} day(s)".format(days))
68+
if hours > 0 or days > 0 or weeks > 0:
69+
output.append("{} hour(s)".format(hours))
70+
if minutes > 0 or hours > 0 or days > 0 or weeks > 0:
7471
output.append("{} minute(s)".format(minutes))
75-
output = " ".join(output)
72+
73+
output.append("{} second(s)".format(seconds))
74+
75+
output = " ".join(output)
7676
return output
7777

7878
def connect(args):

0 commit comments

Comments
 (0)