OmEspHelpers
|
#include <OmNtp.h>
Public Member Functions | |
void | setWifiAvailable (bool wifiAvailable) |
void | tick (long milliseconds) |
void | setTimeZone (int hourOffset) |
int | getTimeZone () |
void | setLocalTimeZone () |
void | setTimeUrl (const char *timeUrl) |
bool | getTime (int &hourOut, int &minuteOut, int &secondOut) |
bool | getTime (int &hourOut, int &minuteOut, float &secondOut) |
const char * | getTimeString () |
bool | getUTime (uint32_t &uTimeOut, int &uFracOut) |
uint32_t | getUTime () |
bool | uTimeToTime (uint32_t uTime, int uFrac, int &hourOut, int &minuteOut, float &secondOut) |
Static Public Member Functions | |
static OmNtp * | ntp () |
class to keep a local clock synchronized from a server
bool OmNtp::getTime | ( | int & | hourOut, |
int & | minuteOut, | ||
float & | secondOut | ||
) |
Get the time of day in two handy integers and a float.
bool OmNtp::getTime | ( | int & | hourOut, |
int & | minuteOut, | ||
int & | secondOut | ||
) |
Get the time of day in three handy integers.
const char * OmNtp::getTimeString | ( | ) |
Get the time of day in a handy string like HH:MM:SS.
(It's a static char[], by the way.)
|
static |
Get the last-created ntp instance, if any
void OmNtp::setLocalTimeZone | ( | ) |
Issue a request to an http service, the url you set with setTimeUrl().
void OmNtp::setTimeUrl | ( | const char * | timeUrl | ) |
URL to a server under your control that gives the current time.
OmNtp will deduce the timezone relative to NTP from it, also.
Https not supported, just http.
void OmNtp::setTimeZone | ( | int | hourOffset | ) |
This number gets added to UTC for your time zone. It ranges
from -12 to +12. California in December needs -8.
void OmNtp::setWifiAvailable | ( | bool | wifiAvailable | ) |
Call this after wifi properly established
void OmNtp::tick | ( | long | milliseconds | ) |
Call this in your loop(). Assumes about 20-50 ms interval.