OmEspHelpers
|
#include <OmNtp.h>
Classes | |
class | OmNtpStats |
Public Member Functions | |
void | setWifiAvailable (bool wifiAvailable) |
void | tick (unsigned int deltaMillis) |
void | setTimeZone (int hourOffset) |
int | getTimeZone () |
void | getLocalTime () |
void | setTimeUrl (const char *timeUrl) |
void | setTimeUrlOffset (int hoursFromTimeUrl) |
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 () |
Static Public Member Functions | |
static OmNtp * | ntp () |
static void | sGetTimeOfDay (int &minuteWithinDayOut, float &secondWithinMinuteOut) |
Static methods to get the time, and return -1's if time does not exist in space. | |
Public Attributes | |
OmNtpStats | stats |
WiFiClient | client |
class to keep a local clock synchronized from a server
void OmNtp::getLocalTime | ( | ) |
Issue a request to an http service, the url you set with setTimeUrl().
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::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::setTimeUrlOffset | ( | int | hoursFromTimeUrl | ) |
if the time is calculated from a TimeUrl, add this offset to it.
for example, I use a CA timeUrl for my lamps in Arkansas so I set
it to 2.
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 | ( | unsigned int | deltaMillis | ) |
Call this in your loop(). Assumes about 20-50 ms interval.
WiFiClient OmNtp::client |
client is public field so you can use it for URL queries too.