diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2011-11-01 11:39:52 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2011-11-01 19:52:12 -0700 |
commit | 18b8247cb357a9a716846854e451e306b752e542 (patch) | |
tree | f4df344653f038554747f90ad34587dc331e0d5a /profile.c | |
parent | 43601f654675c8734c9ca5850cc41dac16d1989a (diff) | |
download | subsurface-18b8247cb357a9a716846854e451e306b752e542.tar.gz |
Add new helper function to get temperature and unit
Designed along the lines of get_depth_units - except we don't define a
specific number of digits to show.
Use this in the one spot we need it right now in profile.c
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile.c')
-rw-r--r-- | profile.c | 14 |
1 files changed, 4 insertions, 10 deletions
@@ -485,19 +485,13 @@ static int setup_temperature_limits(struct graphics_context *gc, struct plot_inf static void plot_single_temp_text(struct graphics_context *gc, int sec, int mkelvin) { - int deg; + double deg; const char *unit; static const text_render_options_t tro = {12, 0.2, 0.2, 1.0, LEFT, TOP}; - temperature_t temperature = { mkelvin }; - if (output_units.temperature == FAHRENHEIT) { - deg = to_F(temperature); - unit = UTF8_DEGREE "F"; - } else { - deg = to_C(temperature); - unit = UTF8_DEGREE "C"; - } - plot_text(gc, &tro, sec, temperature.mkelvin, "%d%s", deg, unit); + deg = get_temp_units(mkelvin, &unit); + + plot_text(gc, &tro, sec, mkelvin, "%d%s", (int)(deg + 0.5), unit); } static void plot_temperature_text(struct graphics_context *gc, struct plot_info *pi) |