From 5dfbba01b1150dd7e1ebd72610943cad4a63c7cf Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Fri, 11 Sep 2015 15:39:34 +0200 Subject: reproducible: convert duration to human readable information --- bin/reproducible_html_live_status.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'bin/reproducible_html_live_status.py') diff --git a/bin/reproducible_html_live_status.py b/bin/reproducible_html_live_status.py index 426ff810..96d6eb2a 100755 --- a/bin/reproducible_html_live_status.py +++ b/bin/reproducible_html_live_status.py @@ -11,6 +11,22 @@ from reproducible_common import * from reproducible_html_indexes import build_leading_text_section +def convert_into_hms_string(duration): + if not duration: + duration = "None" + else: + hours = int(duration/3600) + minutes = int((duration-(hours*3600))/60) + seconds = int(duration-(hours*3600)-(minutes*60)) + duration = '' + if hours > 0: + duration = str(hours)+'h ' + str(minutes)+'m ' + str(seconds) + 's' + elif minutes > 0: + duration = str(minutes)+'m ' + str(seconds) + 's' + else: + duration = str(seconds+"s") + return duration + def generate_schedule(arch): """ the schedule pages are very different than others index pages """ log.info('Building the schedule index page for ' + arch + '...') @@ -63,11 +79,12 @@ def generate_live_status_table(arch): suite = row[1] arch = row[2] pkg = row[3] + duration = convert_into_hms_string(row[7]) html += tab + ' ' + str(row[0]) + '' html += '' + suite + '' + arch + '' html += '' + link_package(pkg, suite, arch) + '' html += '' + str(row[4]) + '' + str(row[5]) + '' - html += '' + str(row[6]) + '' + str(row[7]) + ' ' + html += '' + str(row[6]) + '' + duration + ' ' html += '' + str(row[8]) + '' html += '\n' html += '

\n' -- cgit v1.2.3-54-g00ecf