[Xfce4-commits] <xfce4-weather-plugin:master> Undo rounding of precipitations and use better precision for inches.

Harald Judt noreply at xfce.org
Thu Jan 10 16:34:05 CET 2013


Updating branch refs/heads/master
         to eb4e6632d18b6501fba14237809b1e39125c48fe (commit)
       from 8955d13b933f299cb15f964847fadd4c35caa5e9 (commit)

commit eb4e6632d18b6501fba14237809b1e39125c48fe
Author: Harald Judt <h.judt at gmx.at>
Date:   Tue Jan 8 23:49:21 2013 +0100

    Undo rounding of precipitations and use better precision for inches.
    
    It was a bad idea to round precipitation values to integer,
    especially rounding inches, as precipitation in inches is in
    most cases below 0.10.

 panel-plugin/weather-data.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/panel-plugin/weather-data.c b/panel-plugin/weather-data.c
index b2c25fb..ba1e2de 100644
--- a/panel-plugin/weather-data.c
+++ b/panel-plugin/weather-data.c
@@ -398,9 +398,11 @@ get_data(const xml_time *timeslice,
 
     case PRECIPITATIONS:   /* source is in millimeters */
         val = string_to_double(loc->precipitation_value, 0);
-        if (units->precipitations == INCHES)
+        if (units->precipitations == INCHES) {
             val /= 25.4;
-        return g_strdup_printf(ROUND_TO_INT("%.1f"), val);
+            return g_strdup_printf("%.2f", val);
+        } else
+            return g_strdup_printf("%.1f", val);
 
     case SYMBOL:
         return CHK_NULL(loc->symbol);


More information about the Xfce4-commits mailing list