Datasheet

Flyport Wi-Fi and Ethernet Programmer's guide framework 2.3 (rev 1.0) www.openpicus.com
SNTP Usage Example
A very short usage example of SNTP features is shown here:
#include "taskFlyport.h"
#include "time.h"
time_t now;
struct tm* ts;
DWORD epoch = 0;
DWORD epochtime = 0xA2C2A;
char dateUTC[50] = "waiting...";
// to properly set GMT by adding or removing
// the hours for GMT zone (for example Rome = +1 or +2 GMT)
// negative values are supported too...
int GMT_hour_adding = 2;
void FlyportTask()
{
// Flyport Wi-Fi // Flyport Ethernet
WFConnect(WF_DEFAULT); while(!MAClinked);
while (WFStatus != CONNECTED);
UARTWrite(1,"Flyport connected... hello world!\r\n");
vTaskDelay(200);
UARTWrite(1, dateUTC);
while(epoch<epochtime)
{
vTaskDelay(50);
epoch=SNTPGetUTCSeconds();
UARTWrite(1, ".");
}
UARTWrite(1, "done!\r\n");
while(1)
{
vTaskDelay(20);
epoch=SNTPGetUTCSeconds();
now=(time_t)epoch;
ts = localtime(&now);
// GMT adding 2 hours test
ts->tm_hour = (ts->tm_hour + GMT_hour_adding);
// Correct if overflowed hour 0-24 format
67