[pmg-devel] [PATCH pmg-api] actually calculate day when it is given

Dominik Csapak d.csapak at proxmox.com
Wed Aug 8 14:29:17 CEST 2018


we did not actualy calculate the start and enddate for a day
if it was specified, but for the month

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PMG/API2/Statistics.pm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/PMG/API2/Statistics.pm b/PMG/API2/Statistics.pm
index 7c2a300..7eb8d18 100644
--- a/PMG/API2/Statistics.pm
+++ b/PMG/API2/Statistics.pm
@@ -163,9 +163,10 @@ my $extract_start_end = sub {
 	$month += 1;
 	$year = $param->{year} if defined($param->{year});
 	if (defined($param->{day})) {
+	    my $day = $param->{day};
 	    $month = $param->{month} if defined($param->{month});
-	    $start = timelocal(0, 0, 0, 1, $month - 1, $year);
-	    $end = timelocal(0, 0, 0, 1, $month, $year);
+	    $start = timelocal(0, 0, 0, $day, $month - 1, $year);
+	    $end = timelocal(59, 59, 23, $day, $month - 1, $year);
 	} elsif (defined($param->{month})) {
 	    my $month = $param->{month};
 	    if ($month < 12) {
-- 
2.11.0




More information about the pmg-devel mailing list