OmEspHelpers
Public Member Functions | Static Public Member Functions | List of all members
OmNtp Class Reference

#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 OmNtpntp ()
 

Detailed Description

class to keep a local clock synchronized from a server

Member Function Documentation

◆ getTime() [1/2]

bool OmNtp::getTime ( int &  hourOut,
int &  minuteOut,
float &  secondOut 
)

Get the time of day in two handy integers and a float.

◆ getTime() [2/2]

bool OmNtp::getTime ( int &  hourOut,
int &  minuteOut,
int &  secondOut 
)

Get the time of day in three handy integers.

◆ getTimeString()

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.)

◆ ntp()

OmNtp * OmNtp::ntp ( )
static

Get the last-created ntp instance, if any

◆ setLocalTimeZone()

void OmNtp::setLocalTimeZone ( )

Issue a request to an http service, the url you set with setTimeUrl().

◆ 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.

◆ setTimeZone()

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.

◆ setWifiAvailable()

void OmNtp::setWifiAvailable ( bool  wifiAvailable)

Call this after wifi properly established

◆ tick()

void OmNtp::tick ( long  milliseconds)

Call this in your loop(). Assumes about 20-50 ms interval.


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