summaryrefslogtreecommitdiffhomepage
path: root/Temperature.cpp
blob: dece26ab691b1aee2f69f00a9f894c0deb057ea8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "Temperature.h"

#include <libreichwein/file.h>

#include <filesystem>

namespace fs = std::filesystem;

namespace {
  // e.g. 46000 for 46C
  fs::path temp_path{"/sys/class/thermal/thermal_zone0/temp"};
}

Temperature::Temperature()
{
}

int Temperature::read_degree() const
{
  std::string contents {Reichwein::File::getFile(temp_path)};
  return std::stoul(contents) / 1000;
}