fixed irgendwas with timezones

This commit is contained in:
2021-11-21 03:55:37 +01:00
parent f9083d44b4
commit 33d273bbad
9 changed files with 50 additions and 9 deletions

View File

@ -1,5 +1,7 @@
#include "timesettingsmenu.h"
#include "sdkconfig.h"
// 3rdparty lib includes
#include <espchrono.h>
#include <fmt/core.h>
@ -32,7 +34,11 @@ class CurrentLocalDateTimeText : public virtual espgui::TextInterface
public:
std::string text() const override
{
#ifdef CONFIG_ESPCHRONO_SUPPORT_DEFAULT_TIMEZONE
return fmt::format("local: {}", espchrono::toString(espchrono::toDateTime(espchrono::local_clock::now())));
#else
return "TODO";
#endif
}
};

View File

@ -7,7 +7,6 @@
#include <FastLED.h>
#ifdef FEATURE_LEDSTRIP
#define crgb_iterator __gnu_cxx::__normal_iterator<CRGB *, std::vector<CRGB>>
enum Bobbycar_Side
{
FRONT_RIGHT,

View File

@ -10,6 +10,22 @@
// 3rdparty lib includes
#include <espstrutils.h>
// local includes
#include "globals.h"
espchrono::time_zone get_default_timezone() noexcept
{
using namespace espchrono;
return time_zone{minutes32{settings.timeSettings.timezoneOffset}, settings.timeSettings.daylightSavingMode};
}
#ifdef CONFIG_ESPCHRONO_SUPPORT_DEFAULT_TIMEZONE
espchrono::time_zone espchrono::get_default_timezone() noexcept
{
return ::get_default_timezone();
}
#endif
namespace {
constexpr const char * const TAG = "BOBBYTIME";
} // namespace

View File

@ -1,15 +1,11 @@
#pragma once
#include "sdkconfig.h"
// 3rdparty lib includes
#include <espchrono.h>
// local includes
#include "globals.h"
auto espchrono::local_clock::timezone() noexcept -> time_zone
{
return time_zone{minutes32{settings.timeSettings.timezoneOffset}, settings.timeSettings.daylightSavingMode};
}
espchrono::time_zone get_default_timezone() noexcept;
#ifdef FEATURE_NTP
void initTime();

View File

@ -180,6 +180,12 @@ CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP_INFO=y
CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP=3
# end of Simple Async HTTP Request
#
# espchrono Configuration
#
# CONFIG_ESPCHRONO_SUPPORT_DEFAULT_TIMEZONE is not set
# end of espchrono Configuration
#
# ESP Config lib settings
#

View File

@ -180,6 +180,12 @@ CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP_INFO=y
CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP=3
# end of Simple Async HTTP Request
#
# espchrono Configuration
#
CONFIG_ESPCHRONO_SUPPORT_DEFAULT_TIMEZONE=y
# end of espchrono Configuration
#
# ESP Config lib settings
#

View File

@ -180,6 +180,12 @@ CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP_INFO=y
CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP=3
# end of Simple Async HTTP Request
#
# espchrono Configuration
#
CONFIG_ESPCHRONO_SUPPORT_DEFAULT_TIMEZONE=y
# end of espchrono Configuration
#
# ESP Config lib settings
#

View File

@ -180,6 +180,12 @@ CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP_INFO=y
CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP=3
# end of Simple Async HTTP Request
#
# espchrono Configuration
#
CONFIG_ESPCHRONO_SUPPORT_DEFAULT_TIMEZONE=y
# end of espchrono Configuration
#
# ESP Config lib settings
#