Calculating Daylight saving and UTC offset in QT
void getTimeZoneOffset() { QString UTC_offset; time_t current_time; time(¤t_time); QString Daylighsaving ; struct tm *timeinfo = localtime(¤t_time); double offset = (timeinfo->tm_gmtoff)/60; if (timeinfo->tm_isdst) { offset += 60; Daylighsaving = "1"; } if (offset > 0) { offset = -offset; } else{ offset = -(offset); } UTC_offset = QString::number(offset); }