JBWOPR
Loading...
Searching...
No Matches
JBTimeHelper Class Reference

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 tzString="")
 Configure helper with NTP Server and time offset.
static bool getTime (tm *info)
 Get local time.
static bool setTime (const std::string currentDateTime)

Detailed Description

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.

Member Function Documentation

◆ configure()

void JBTimeHelper::configure ( JBLogger * log,
std::string ntpServer = "",
std::string tzString = "" )
static

Configure helper with NTP Server and time offset.

Parameters
configWiFi configuration

◆ getTime()

bool JBTimeHelper::getTime ( tm * info)
static

Get local time.

Parameters
ntpServerNTP server address
infoPointer to tm struct

Uses NTP server pool.ntp.org to set local time

Returns
True if successful

◆ setTime()

bool JBTimeHelper::setTime ( const std::string currentDateTime)
static

Sets the current date and time.

Parameters
currentDateTimeThe current date/time as a string in ISO format.

Example date/time in ISO format: 2025-02-16T22:03:00

Returns
True if successful

The documentation for this class was generated from the following files: