From b5fce4e414842b47d8729af206d5e020dcf6479a Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 26 Jul 2018 10:17:46 +0200 Subject: buildmaster/status.php: show average age of testing packages --- lib/converter.php | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 lib/converter.php (limited to 'lib/converter.php') diff --git a/lib/converter.php b/lib/converter.php new file mode 100644 index 0000000..41951c7 --- /dev/null +++ b/lib/converter.php @@ -0,0 +1,86 @@ + 1) + $result = + sprintf( + "%d days and %s", + $tmp, + $result + ); + elseif ($tmp == 1) + $result = + sprintf( + "%d day and %s", + $tmp, + $result + ); + else + $printed_conjunction = false; + $val = floor($val / 7); + if ($val == 0) + return $result; + if ($printed_conjunction) + $result = + sprintf( + ", %s", + $result + ); + else + $result = + sprintf( + " and %s", + $result + ); + if ($val>1) + $result = + sprintf( + "%d weeks%s", + $val, + $result + ); + else + $result = + sprintf( + "%d week%s", + $val, + $result + ); + return $result; +} -- cgit v1.2.3-70-g09d2