Problem with QTimeZone
-
wrote on 8 Oct 2020, 15:20 last edited by maxwell31 10 Aug 2020, 15:27
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? -
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?wrote on 8 Oct 2020, 15:38 last edited by@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? -
wrote on 8 Oct 2020, 16:10 last edited by
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/3