Closed junleus closed 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);
drawString(x + fwidth / 2, y + 4, String(ConvertUnixTime(WxForecast[index].Dt + WxConditions[0].Timezone).substring(0,5)), CENTER);
return output; }`
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’
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; }`