diff --git a/statusweather.cpp b/statusweather.cpp index 2f4da24..a7d36af 100644 --- a/statusweather.cpp +++ b/statusweather.cpp @@ -39,6 +39,7 @@ struct weather { float temperature{-273.15}; std::string icon{"❗"}; + bool old{true}; } __attribute__((aligned(64))) weather; // NOLINT(cert-err58-cpp) std::mutex mutex_weather; @@ -137,9 +138,14 @@ bool fetch_weather() weather.temperature = json[0]["main"]["temp"].get(); weather.icon = map_icon( json[0]["weather"][0]["icon"].get()); - return true; + weather.old = false; } - return false; + else + { + weather.old = true; + } + + return true; } void print_weather() @@ -164,8 +170,9 @@ void print_weather() return "#66ff66"; }()}; - std::cout << format(R"({0:s} {2:.1f}°C)", - weather.icon, color, weather.temperature) + std::cout << format(R"({0:s} {2:.1f}°C{3:s})", + weather.icon, color, weather.temperature, + weather.old ? R"( )" : "") << std::endl; }