LOGGER
Logger
Data Logging using ESP8266
|
#include "timeservices.h"
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <WiFiServer.h>
#include <WiFiUdp.h>
#include <Time.h>
#include "dataservices.h"
#include "security.h"
#include "webpages.h"
#include "webservices.h"
Macros | |
#define | timeServicesEdit 2 |
version of this module | |
Functions | |
EXTERNDEF void | timeservicesLoop () |
EXTERNDEF String | timeservicesDumpTime (time_t t) |
EXTERNDEF void | dumpAmountOfTime (Print *pPrinter, time_t amount) |
EXTERNDEF void | dumpAmountOfTimeMS (Print *pPrinter, uint32_t milliAmount) |
EXTERNDEF void | timeservicesInit () |
Initialize time services, call once at system startup. | |
EXTERNDEF time_t | timeServicesGetNTPtime () |
EXTERNDEF bool | timeservicesTimeIsValid () |
EXTERNDEF void | timeservicesConfigurationPage () |
display the time configuration page | |
Variables | |
const int | timeZone = 0 |
Time zone used by library functions. | |
EXTERNVAR bool | timeservicesTimeWasManuallySet |
Set to true if time was set by a console command. More... | |
EXTERNVAR bool | timeservicesReportRequired |
Time syncronization services
EXTERNDEF void dumpAmountOfTime | ( | Print * | pPrint, |
time_t | seconds | ||
) |
Dump an amount of time
pPrint | where to output the time |
seconds | amount of time to dump |
EXTERNDEF void dumpAmountOfTimeMS | ( | Print * | pPrint, |
uint32_t | milliAmount | ||
) |
Dump an amount of time
pPrint | where to output the time |
milliAmount | amount of time to dump in ms |
EXTERNDEF String timeservicesDumpTime | ( | time_t | t | ) |
Convert a UNIX time to a string
t | time to convert |
EXTERNDEF time_t timeServicesGetNTPtime | ( | ) |
Send an NTP packet and wait for the response, return the Unix time
To lower the memory footprint, no buffers are allocated for sending and receiving the NTP packets. Four bytes of memory are allocated for transmision, the rest is random garbage collected from the data memory segment, and the received packet is read one byte at a time. The Unix time is returned, that is, seconds from 1970-01-01T00:00.
EXTERNDEF void timeservicesLoop | ( | ) |
Perform periodic tasks managing timeservices. Call frequently as the system runs. Does not block.
EXTERNDEF bool timeservicesTimeIsValid | ( | ) |
Determine if time has a valid value. Time might be set manually or retrieved from the web.
EXTERNVAR bool timeservicesReportRequired |
Set this flag to trigger a time report. Safe to set in an ISR.
EXTERNVAR bool timeservicesTimeWasManuallySet |
Set to true if time was set by a console command.
Set to true when time is set by a console command. This gets reset if the time is automatically set from the web.