Added additional windspeed units, km, and mph. Orginal windspeed moved to knots
authorJoe Myre <joemyre@users.sourceforge.net>
Fri, 12 Aug 2005 16:31:03 +0000 (16:31 +0000)
committerJoe Myre <joemyre@users.sourceforge.net>
Fri, 12 Aug 2005 16:31:03 +0000 (16:31 +0000)
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@107 7f574dfc-610e-0410-a909-a81674777703

conky.c
metarinfo.c
metarinfo.h

diff --git a/conky.c b/conky.c
index 20816a9..e3b762d 100644 (file)
--- a/conky.c
+++ b/conky.c
@@ -3,7 +3,11 @@
  *
  * This program is licensed under BSD license, read COPYING
  *
+<<<<<<< conky.c
  *  $Id$
+=======
+ *  $Id$
+>>>>>>> 1.58
  */
 
 #include "conky.h"
@@ -773,6 +777,8 @@ enum text_object_type {
        OBJ_metar_dew_point,
        OBJ_metar_rh,
        OBJ_metar_windspeed,
+       OBJ_metar_windspeed_km,
+       OBJ_metar_windspeed_mph,
        OBJ_metar_winddir,
        OBJ_metar_swinddir,
        OBJ_metar_cloud,
@@ -1383,6 +1389,10 @@ int a = stippled_borders, b = 1;
            END
            OBJ(metar_windspeed, INFO_METAR)
            END
+           OBJ(metar_windspeed_km, INFO_METAR)
+           END
+           OBJ(metar_windspeed_mph, INFO_METAR)
+           END
            OBJ(metar_winddir, INFO_METAR)
            END
            OBJ(metar_swinddir, INFO_METAR)
@@ -2492,8 +2502,23 @@ static void generate_text()
                                if (data.winData.windSpeed != INT_MAX
                                    && metar_worked)
                                        snprintf(p, n, "%i",
-                                                knTokph(data.winData.
-                                                        windSpeed));
+                                                data.winData.windSpeed);
+                               else
+                                       snprintf(p, n, "-");
+                       }
+                       OBJ(metar_windspeed_km) {
+                               if (data.winData.windSpeed != INT_MAX
+                                   && metar_worked)
+                                       snprintf(p, n, "%'.2f",
+                                                (data.winData.windSpeed * 1.852));
+                               else
+                                       snprintf(p, n, "-");
+                       }
+                       OBJ(metar_windspeed_mph) {
+                               if (data.winData.windSpeed != INT_MAX
+                                   && metar_worked)
+                                       snprintf(p, n, "%'.2f",
+                                                (data.winData.windSpeed * 1.151));
                                else
                                        snprintf(p, n, "-");
                        }
index f8ac0ac..c1d24dd 100644 (file)
@@ -28,18 +28,19 @@ int calculateRelativeHumidity(int temp, int dew)
 
 int calculateWindChill(int temperatureC, int windKn)
 {
-       double windKmh = knTokph(windKn);
+       double windKmh = windKn * 1.852;
        return (int) (13.112 + 0.6215 * temperatureC -
                      11.37 * powf(windKmh,
                                   .16) +
                      0.3965 * temperatureC * powf(windKmh, .16));
 }
 
+/*Should no longer be needed
 int knTokph(int knSpeed)
 {
        return (knSpeed * 1.852);
 }
-
+*/
 const char *calculateWindDirectionString(int degree)
 {
        if (degree < 22.5) {
index 0e88445..76a1aa0 100644 (file)
@@ -12,7 +12,7 @@
 
 int calculateRelativeHumidity(int, int);
 int calculateWindChill(int, int);
-int knTokph(int);
+//int knTokph(int);
 const char *calculateWindDirectionString(int);
 const char *calculateShortWindDirectionString(int);