Bug 200763

Summary: x11/plasma5-plasma: time widget not taking into account time zones
Product: Ports & Packages Reporter: sebastienmainand
Component: Individual Port(s)Assignee: freebsd-kde (Team) <kde>
Status: Closed Works As Intended    
Severity: Affects Only Me CC: jhb, mikael, rakuco, tcberner, tcberner
Priority: ---    
Version: Latest   
Hardware: amd64   
OS: Any   

Description sebastienmainand 2015-06-10 12:44:03 UTC
I tried to set the timezone of the "Digital Clock" widget of the default panel.

I access the configuration panel using "right click > Digital Clock settings... > Time zones", set "Paris" the only city selected, saved and reboot but the time does not adjust.

This parameter seems to be used by the desktop as the time displayed on the lock screen is correct. For example, if the correct time is 14:00, the widget will show 12:00 - the lock screen shows 14:00.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2015-06-10 13:57:25 UTC
There is no port with this name.  Can you please clarify?
Comment 2 Raphael Kubo da Costa freebsd_committer 2016-02-21 17:52:52 UTC
Assign to the right maintainer.

Tobias, do you know if this is still a valid bug?
Comment 3 Tobias Berner 2016-02-21 21:59:14 UTC
(In reply to Raphael Kubo da Costa from comment #2)
First of all sorry, I totally missed this bug report.

I tested it here, and right-clicking on the digital-clock in the panel and selecting "Digital Clock Settings" and choosing your wanted time zone(s) in the "Timezones"-tab  should work now (plasma 5.5.4). I think that was an upstream issue.

But I will have to check whether it picks up the correct local time zone by default too.
Comment 4 Mikael Urankar freebsd_committer 2016-02-22 08:21:00 UTC
I've had the same problem and I think it depends on whether /etc/localtime is a symlink to /usr/share/zoneinfo/Europe/Paris or a regular file.
Mine is a symlink and everything works fine.
Comment 5 Tobias C. Berner freebsd_committer 2016-09-28 20:50:58 UTC
Yes Mikael is right, looking at qt's code [1] it is indeed necessary that /etc/localtime [1] is a symlink to a timezone file for Qt to determine it.

[1] https://github.com/qt/qtbase/blob/990969655c5fb4d03682e96df9b12101f5ee9815/src/corelib/tools/qtimezoneprivate_tz.cpp#L952
Comment 6 John Baldwin freebsd_committer freebsd_triage 2018-06-13 15:06:39 UTC
This isn't really correct as the default behavior of FreeBSD is to use 'cp' for /etc/localtime instead of a symlink.  Qt should instead learn about /var/db/zoneinfo.  In that blob of Qt code from the URL, it already checks for '/etc/timezone' on Debian, the same check would work if it also checked for /var/db/zoneinfo on FreeBSD.
Comment 7 John Baldwin freebsd_committer freebsd_triage 2018-06-13 15:50:53 UTC
See https://reviews.freebsd.org/D15792
Comment 8 commit-hook freebsd_committer 2018-06-13 17:02:36 UTC
A commit references this bug:

Author: jhb
Date: Wed Jun 13 17:02:32 UTC 2018
New revision: 472335
URL: https://svnweb.freebsd.org/changeset/ports/472335

  Recognize timezones on FreeBSD for the default install.

  By default, FreeBSD copies the current timezone database to
  /etc/localtime and stores the name of the symlink in /var/db/zoneinfo.
  Qt expects /etc/localtime to be a symlink and uses the symlink's
  target to infer the name of the default timezone.  The existing code
  in Qt includes some workarounds for Linux distributions that also copy
  the current timezone to /etc/localtime by checking for files that
  contain the name of the timezone.  Add a similar check for
  /var/db/zoneinfo on FreeBSD.

  PR:		200763
  Reviewed by:	tcberner
  Differential Revision:	https://reviews.freebsd.org/D15792