| 123 | const int clockUpdateIntervalMs = 10 * 60 * 1000; // Update web clock every 10 minutes |
| 124 | |
| 125 | int onClockUpdating(HttpConnection& client, bool successful) |
| 126 | { |
| 127 | auto& response = *client.getResponse(); |
| 128 | |
| 129 | if(!successful) { |
| 130 | Serial << _F("CLOCK UPDATE FAILED, ") << response.code << " " << toString(response.code) << endl; |
| 131 | lastClockUpdate = 0; |
| 132 | return -1; |
| 133 | } |
| 134 | |
| 135 | // Extract date header from response |
| 136 | clockValue = response.headers.getServerDate(); |
| 137 | if(clockValue.isNull()) { |
| 138 | clockValue = response.headers.getLastModifiedDate(); |
| 139 | } |
| 140 | if(!clockValue.isNull()) { |
| 141 | clockValue.addMilliseconds(ActiveConfig.AddTZ * 1000 * 60 * 60); |
| 142 | } |
| 143 | |
| 144 | return 0; |
| 145 | } |
| 146 | |
| 147 | void refreshClockTime() |
| 148 | { |
nothing calls this directly
no test coverage detected