MCPcopy Create free account
hub / github.com/SmingHub/Sming / refreshClockTime

Function refreshClockTime

samples/MeteoControl/app/application.cpp:147–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147void refreshClockTime()
148{
149 uint32_t nowClock = millis();
150 if(nowClock < lastClockUpdate) {
151 lastClockUpdate = 0; // Prevent overflow, restart
152 }
153 if((lastClockUpdate == 0 || nowClock - lastClockUpdate > clockUpdateIntervalMs)) {
154 clockWebClient.downloadString("google.com", onClockUpdating);
155 lastClockUpdate = nowClock;
156 } else if(!clockValue.isNull()) {
157 clockValue.addMilliseconds(clockRefresher.getIntervalMs());
158 }
159
160 if(clockValue.isNull()) {
161 return;
162 }
163
164 StrTime = clockValue.toShortDateString() + " " + clockValue.toShortTimeString(false);
165 StrTime.setCharAt(13, ((nowClock % 2000) > 1000) ? ' ' : ':');
166}
167
168} // namespace
169

Callers

nothing calls this directly

Calls 8

millisFunction · 0.85
downloadStringMethod · 0.80
addMillisecondsMethod · 0.80
getIntervalMsMethod · 0.80
toShortDateStringMethod · 0.80
toShortTimeStringMethod · 0.80
setCharAtMethod · 0.80
isNullMethod · 0.45

Tested by

no test coverage detected