From 84915674a84dccce4c69cb1d9da4593a310bce70 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Wed, 14 Dec 2022 20:10:58 +0100 Subject: [PATCH] fix integer declaration for temperature values --- wundergroundAPI.pm | 52 ++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/wundergroundAPI.pm b/wundergroundAPI.pm index 2a0cf55..fc3d2c3 100644 --- a/wundergroundAPI.pm +++ b/wundergroundAPI.pm @@ -388,18 +388,16 @@ sub _ProcessingRetrieveData($$) { ); $self->{cached}{current} = { - 'dewPoint' => - int( sprintf( "%.1f", $data->{$unit}{dewpt} ) + 0.5 ), - 'heatIndex' => $data->{$unit}{heatIndex}, + 'dewPoint' => sprintf( "%.1f", $data->{$unit}{dewpt} ), + 'heatIndex' => $data->{$unit}{heatIndex}, 'precipRate' => $data->{$unit}{precipRate}, 'precipTotal' => $data->{$unit}{precipTotal}, 'pressure' => int( sprintf( "%.1f", $data->{$unit}{pressure} ) + 0.5 ), 'temperature' => - int( sprintf( "%.1f", $data->{$unit}{temp} ) + 0.5 ), - 'temp_c' => - int( sprintf( "%.1f", $data->{$unit}{temp} ) + 0.5 ), + sprintf( "%.1f", $data->{$unit}{temp} ), + 'temp_c' => sprintf( "%.1f", $data->{$unit}{temp} ), 'wind_chill' => int( sprintf( "%.1f", ( $data->{$unit}{windChill} ) ) + 0.5 @@ -507,33 +505,27 @@ sub _ProcessingRetrieveData($$) { ) ) ), - 'low_c' => int( - sprintf( "%.1f", - $data->{temperatureMin}[$i] ) + 0.5 + 'low_c' => sprintf( + "%.1f", $data->{temperatureMin}[$i] ), - 'high_c' => int( - sprintf( - "%.1f", - ( - $data->{temperatureMax}[$i] - ? $data->{temperatureMax}[$i] - : 0 - ) - ) + 0.5 + 'high_c' => sprintf( + "%.1f", + ( + $data->{temperatureMax}[$i] + ? $data->{temperatureMax}[$i] + : 0 + ) ), - 'tempLow' => int( - sprintf( "%.1f", - $data->{temperatureMin}[$i] ) + 0.5 + 'tempLow' => sprintf( + "%.1f", $data->{temperatureMin}[$i] ), - 'tempHigh' => int( - sprintf( - "%.1f", - ( - $data->{temperatureMax}[$i] - ? $data->{temperatureMax}[$i] - : 0 - ) - ) + 0.5 + 'tempHigh' => sprintf( + "%.1f", + ( + $data->{temperatureMax}[$i] + ? $data->{temperatureMax}[$i] + : 0 + ) ), } );