]> git.tdb.fi Git - ext/subsurface.git/blobdiff - dive.c
Add new helper function to get temperature and unit
[ext/subsurface.git] / dive.c
diff --git a/dive.c b/dive.c
index ed3908928a97c3c7ddfabb7c12d003de4b6f2349..c913e9476798e518861d2cdf7c47185caba0dfb6 100644 (file)
--- a/dive.c
+++ b/dive.c
@@ -29,6 +29,23 @@ void add_event(struct dive *dive, int time, int type, int flags, int value, cons
        remember_event(name);
 }
 
+double get_temp_units(unsigned int mk, const char **units)
+{
+       double deg;
+       const char *unit;
+
+       if (output_units.temperature == FAHRENHEIT) {
+               deg = mkelvin_to_F(mk);
+               unit = UTF8_DEGREE "F";
+       } else {
+               deg = mkelvin_to_C(mk);
+               unit = UTF8_DEGREE "C";
+       }
+       if (units)
+               *units = unit;
+       return deg;
+}
+
 double get_depth_units(unsigned int mm, int *frac, const char **units)
 {
        int decimals;