From 0c75a0867129f325b93d35dbb374072e72746256 Mon Sep 17 00:00:00 2001 From: CamelBackNotation Date: Fri, 27 Feb 2015 15:04:18 -0600 Subject: [PATCH] Fixed the case where -0F would be displayed due to rounding from the conversion specifiers %.0f when round = true --- panel-plugin/weather-data.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/panel-plugin/weather-data.c b/panel-plugin/weather-data.c index 3728199..56effb3 100644 --- a/panel-plugin/weather-data.c +++ b/panel-plugin/weather-data.c @@ -343,8 +343,11 @@ get_data(const xml_time *timeslice, case TEMPERATURE: /* source is in °C */ val = string_to_double(loc->temperature_value, 0); - if (units->temperature == FAHRENHEIT) + if (units->temperature == FAHRENHEIT) { val = val * 9.0 / 5.0 + 32.0; + if (round && (val > -0.5 && val < 0)) + val = val + 0.5; + } return g_strdup_printf(ROUND_TO_INT("%.1f"), val); case PRESSURE: /* source is in hectopascals */ -- 2.1.0