Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Problem with QTimeZone



  • Hi,

    I try to make a list of available time zones for a given country, and for this I use QTimeZone:

    _availableTimezones = QTimeZone::availableTimeZoneIds();
    for(auto zone: _availableTimezones) {
      QTimeZone tmp= QTimeZone(zone);
    _longName = timeZone.displayName(QDateTime(),QTimeZone::LongName);
    _shortName = timeZone.displayName(QDateTime(),QTimeZone::ShortName);
    _offsetString = timeZone.displayName(QDateTime(),QTimeZone::OffsetName);
    

    This works fine on my ubuntu machine. Long name is .e.g. Central European Standard Time, short name CEST and offset string e.g. UTC+2
    If I do the same on a Raspberry though, longName, shortName and offset String are all the same, e.g. CET (also the offset is CET). Why is this happening?



  • @maxwell31
    At a guess: Have you read through all the description in https://doc.qt.io/qt-5/qtimezone.html#remarks ? If RPi "saves on space or features" maybe it does not have the tables?



  • Not sure what you mean. I think I read it but did not see anything relevant. So the RPi for sure supports the Iana Timezones, as you can set them in raspi-config or directly with datetimectl.


Log in to reply