G6EJD / ESP32-e-Paper-Weather-Display

An ESP32 and 2.9", 4.2" or 7.5" ePaper Display reads Weather Underground data via their API and then displays the weather
Other
978 stars 207 forks source link

Year 2038 problem #147

Closed junleus closed 3 years ago

junleus commented 3 years ago

ConvertUnixTime got 2038 issue. when convert 2^31-1 = 2,147,483,647 seconds will got wrong results.

drawString(x + fwidth / 2, y + 4, String(ConvertUnixTime(WxForecast[index].Dt + WxConditions[0].Timezone).substring(0,5)), CENTER); `String ConvertUnixTime2(int unix_time) { // Returns either '21:12 ' or ' 09:12pm' depending on Units mode time_t tm = unix_time; struct tm *now_tm = localtime(&tm); char output[40]; strftime(output, sizeof(output), "%R", now_tm);

return output; }`

G6EJD commented 3 years ago

And what? Will your board be still running 17-years from now? Will OWM still be offering a weather service by then? If your concerned just change the data type to ‘long’