From: Wolfgang Bumiller Date: Wed, 16 May 2018 06:54:55 +0000 (+0200) Subject: fix #1766: compare task starttime numerically X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=commitdiff_plain;h=8733bb8078f7c5d79582dfdd177db306cbc3c9e9 fix #1766: compare task starttime numerically Not only because <=> is correct, but using 'cmp' also has the side effect that it adds a string version to the variable and the API's json output turns into a string as well, and this only happens once a task has completed (while it's an integer while it's still running...) Signed-off-by: Wolfgang Bumiller --- diff --git a/src/PVE/RESTEnvironment.pm b/src/PVE/RESTEnvironment.pm index ebf8a2e..32ffdd1 100644 --- a/src/PVE/RESTEnvironment.pm +++ b/src/PVE/RESTEnvironment.pm @@ -270,7 +270,7 @@ sub active_workers { } - @ta = sort { $b->{starttime} cmp $a->{starttime} } @ta; + @ta = sort { $b->{starttime} <=> $a->{starttime} } @ta; my $save = defined($new_upid);