summaryrefslogtreecommitdiffstats
path: root/index.php
diff options
context:
space:
mode:
authorRomain d'Alverny <rda@mageia.org>2011-04-18 20:49:39 +0000
committerRomain d'Alverny <rda@mageia.org>2011-04-18 20:49:39 +0000
commite02417808c58c8c840a03072fbd078b7e9df043c (patch)
treef2a2c49d46c079ff235ccacade69570f6e675fa4 /index.php
parentef4eb4de8b819d274d805b6309f38c868fb2b8f0 (diff)
downloadpkgsubmit-e02417808c58c8c840a03072fbd078b7e9df043c.tar
pkgsubmit-e02417808c58c8c840a03072fbd078b7e9df043c.tar.gz
pkgsubmit-e02417808c58c8c840a03072fbd078b7e9df043c.tar.bz2
pkgsubmit-e02417808c58c8c840a03072fbd078b7e9df043c.tar.xz
pkgsubmit-e02417808c58c8c840a03072fbd078b7e9df043c.zip
better sort function
Diffstat (limited to 'index.php')
-rw-r--r--index.php26
1 files changed, 24 insertions, 2 deletions
diff --git a/index.php b/index.php
index 1c4eae9..9083a18 100644
--- a/index.php
+++ b/index.php
@@ -361,9 +361,31 @@ if ($total > 0) {
$s .= '</table><br /><br />';
$s .= '<table><caption>Build time</caption></tr><th></th><th></th></tr>';
- ksort($buildtime_stats);
+
+ /**
+ */
+ function timesort($a, $b)
+ {
+ $a = explode(' ', trim($a));
+ $b = explode(' ', trim($b));
+
+ if ($a[1] == 'hour' || $a[1] == 'hours')
+ $a[0] *= 3600;
+
+ if ($b[1] == 'hour' || $a[1] == 'hours')
+ $b[0] *= 3600;
+
+ if ($a[0] > $b[0])
+ return 1;
+ elseif ($a[0] < $b[0])
+ return -1;
+
+ return 0;
+ }
+ uksort($buildtime_stats, "timesort");
+
foreach ($buildtime_stats as $time => $count) {
- $s .= sprintf('<tr><td><td>%s</td><td>%d</td></tr>',
+ $s .= sprintf('<tr><td>%s</td><td>%d</td></tr>',
$time, $count);
}
// TODO (rda) compute/show average for all builds