MCPcopy Create free account
hub / github.com/arduino-libraries/NTPClient / getFormattedTime

Method getFormattedTime

NTPClient.cpp:152–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152String NTPClient::getFormattedTime() const {
153 unsigned long rawTime = this->getEpochTime();
154 unsigned long hours = (rawTime % 86400L) / 3600;
155 String hoursStr = hours < 10 ? "0" + String(hours) : String(hours);
156
157 unsigned long minutes = (rawTime % 3600) / 60;
158 String minuteStr = minutes < 10 ? "0" + String(minutes) : String(minutes);
159
160 unsigned long seconds = rawTime % 60;
161 String secondStr = seconds < 10 ? "0" + String(seconds) : String(seconds);
162
163 return hoursStr + ":" + minuteStr + ":" + secondStr;
164}
165
166void NTPClient::end() {
167 this->_udp->stop();

Callers

nothing calls this directly

Calls 1

getEpochTimeMethod · 0.95

Tested by

no test coverage detected