JBWOPR
|
This class contains helper functions for time related tasks. More...
#include <jbwoprhelpers.h>
Static Public Member Functions | |
static void | configure (JBLogger *log, std::string ntpServer="", std::string timeOffsetString="") |
Configure helper with NTP Server and time offset. | |
static int64_t | getUtcOffsetInSeconds () |
Get UTC offset in seconds. | |
static bool | getTime (tm *info) |
Get local time. | |
static bool | setTime (const std::string currentDateTime) |
This class contains helper functions for time related tasks.
Provides utility methods for time management, including configuring an NTP server, retrieving UTC offset, and setting local time.
This class allows for synchronization with an NTP server to obtain accurate time, calculates the UTC offset using external APIs, and provides methods to obtain or set the local time.
|
static |
Configure helper with NTP Server and time offset.
config | WiFi configuration |
|
static |
Get local time.
ntpServer | NTP server address |
info | Pointer to tm struct |
Uses NTP server pool.ntp.org to set local time
|
static |
Get UTC offset in seconds.
Uses https://ipapi.co/timezone/ to get the local UTC offset
|
static |
Sets the current date and time.
currentDateTime | The current date/time as a string in ISO format. |
Example date/time in ISO format: 2025-02-16T22:03:00