gmag11 / ESPNtpClient

High accuracy NTP library for ESP32 and ESP8266
MIT License
118 stars 25 forks source link

How to get only hours or minutes? #40

Closed ErfanDL closed 2 years ago

ErfanDL commented 2 years ago

Hi. how can I get only hours or minutes with this library ? I do not need to read the full time information. thanks.

gmag11 commented 2 years ago

You need to call internal IDF time functions. Like this:

time_t currentTime = time (NULL);
tm* splitTime = localtime (&currentTime);
int minutes = splitTime ->tm_min;

All them are internal ESP32 SDK functions and have nothing to do with this library