aboutsummaryrefslogtreecommitdiffstats
path: root/src/displayapp/Weather.cpp
blob: a0f0a281c2fe325844306d3b8b84cb96e3dbe894 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include "displayapp/Weather.h"

using namespace Pinetime::Applications;

Temperature Pinetime::Applications::Convert(Controllers::SimpleWeatherService::Temperature temp,
                                            Controllers::Settings::WeatherFormat format) {
  Temperature t = {temp.temp};
  if (format == Controllers::Settings::WeatherFormat::Imperial) {
    t.temp = t.temp * 9 / 5 + 3200;
  }
  t.temp = t.temp / 100 + (t.temp % 100 >= 50 ? 1 : 0);
  return t;
}