Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. QtonPi
  4. Problem with QTimeZone

Problem with QTimeZone

Scheduled Pinned Locked Moved Unsolved QtonPi
3 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    maxwell31
    wrote on last edited by maxwell31
    #1

    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?

    JonBJ 1 Reply Last reply
    0
    • M maxwell31

      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?

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #2

      @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?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        maxwell31
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved