This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Time zone woes

Tags: None
(comma "," separated)
glupie
Registered Member
Posts
67
Karma
0
OS

Time zone woes

Sun Nov 14, 2010 10:24 pm
Is there any way for a user to set the time zone for a KDE session (I do NOT mean changing the system time).

In bash, this is completely trivial (export TZ=...).

Things like Korganizer are completely worthless if they won't display times in the time zone that a user wants to see them.

If it matters (ie., if something was fixed in 4.5.x), I am referring to the 4.4 series.
Kryten2X4B
Registered Member
Posts
911
Karma
4
OS

Re: Time zone woes

Sun Nov 14, 2010 10:45 pm
I'm not sure if this was introduced in 4.5 or earlier, but see in system-settings if you have the module

System Administration->Actions policy.

If you have, you should be able to make sure ordinary users have the right to adjust time-settings. You should find an entry called "Date and time control module" under org.kde. There does not, however, seem to be an option to make sure they can alter _only_ the time-zone (unless I'm blind). If you enable it, they will be able to alter the system-time as well as the time-zone.


OpenSUSE 11.4, 64-bit with KDE 4.6.4
Proud to be a member of KDE forums since 2008-Oct.
glupie
Registered Member
Posts
67
Karma
0
OS

Re: Time zone woes

Mon Nov 15, 2010 2:21 am
> System Administration->Actions policy

I don't see that in 4.4.

> If you have, you should be able to make sure ordinary
> users have the right to adjust time-settings.

I don't want users to be able to adjust "time-settings."
I want users to be able to adjust the time zone that KDE
displays time information in.

> "You should find an entry called "Date and time control
> module" under org.kde.

That's there with a big "You are not allowed to save the
configuration" message.

"If you enable it, they will be able to alter the
system-time as well as the time-zone."

Completely worthless.

One of the nice things about KDE (compared to a major
proprietary operating system) is that it is easy to set
up so that when user A logs in, he gets the interface
in English, when user B logs in, he gets the interface
in Spanish, and when user C logs in, he gets a Russian
interface.

I need (desperately) to set up the machine so that (for
example, keeping Korganizer in mind) that when user A
logs in, he sees all times in EST/EDT (appropriate to
the time of year), when user B logs in, he sees all
times in CEST/CEDT, and when user C logs in, he sees
all times in MSK/MSD.

This should be an environment variable than an ordinary
user is allowed to alter at will.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Time zone woes

Mon Nov 15, 2010 4:27 am
KDE currently only allows the timezone to be set on a system wide basis unfortunately. If only one person is to use the machine at a time however, you may be able to use setsuid scripts to replace the content of /etc/localtime as needed for that user.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
glupie
Registered Member
Posts
67
Karma
0
OS

Re: Time zone woes

Mon Nov 15, 2010 5:51 am
> KDE currently only allows the timezone to be set on a
> system wide basis unfortunately.

No offense, but that seems like quite a poor design.

> If only one person is to use the machine at a time
> however...

Negative on that. Multiple users are logged in (remotely)
simultaneously.

Is there a feature request for this somewhere that I
could follow?

With a preface of "I am only a mediocre scripting
language programmer" (meaning I don't know what I am
talking about), I do have to say that this seems fairly
simple to implement (just read the time zone out a
configuration file, and fall back to /etc/localtime if
that fails).
Kryten2X4B
Registered Member
Posts
911
Karma
4
OS

Re: Time zone woes

Mon Nov 15, 2010 12:30 pm
glupie wrote:> System Administration->Actions policy

I don't see that in 4.4.


In that case, it doesn't matter if the rest of my answer was worthless or not.

Anyway, even if it had worked in 4.4 it would have been essentially a really bad idea to use since I didn't think of KDE's deficit here - in that it only allows setting the time zone system-wide. Which I really should have, because if it allowed setting it per user it wouldn't have made sense to ask for a password to change it. At least none I can think of.

As a sidenote, maybe just my system but for some reason I get the gnome password dialogue rather than the KDE one when I tried to change the time zone.

Anyway, my apologies for an answer that wasn't as thought-through as it should have been.

And as far as your question about a feature request for it, I found a REALLY old one: https://bugs.kde.org/show_bug.cgi?id=64134

There's a sort-of answer in that bug-report but since it's for KDE3 I don't know if it would work for KDE4 as well.

Quote: "To accomplish changing the user's local timezone for applications after KDE has been started, the TZ variable can be initialised with a path to the user's KDE config dir (eg TZ=${KDEHOME}/share/mytime). If ${KDEHOME}/share/mytime does not exist when KDE starts, it can be symlinked to /etc/localtime. "


OpenSUSE 11.4, 64-bit with KDE 4.6.4
Proud to be a member of KDE forums since 2008-Oct.
glupie
Registered Member
Posts
67
Karma
0
OS

Re: Time zone woes

Tue Nov 16, 2010 8:12 am
> In that case, it doesn't matter if the rest of my
> answer was worthless or not.

I actually meant that the behavior (inability to
just set the timezone for a user) was worthless,
not your answer.

> And as far as your question about a feature request
> for it, I found a REALLY old one:
> https://bugs.kde.org/show_bug.cgi?id=64134

You weren't kidding (coming up on eight years old in
a few months).

I assume that workaround means initializing the TZ
variable from a shell, and then running the KDE
applications from a shell?

That appears to at least partially work.

I typed "export TZ=Europe/Moscow" in bash, and then
"korganizer". It does seem to pick up the correct
local time as the current time (a huge improvement),
but still wants to default to the system time for
new entries.

Probably workable, but not elegant. Is there someone
you can ping to take another look at this, given
that the original bug is probably long forgotten (it
does have fifty votes, though :) )?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Time zone woes

Tue Nov 16, 2010 8:17 am
I suggest setting TZ from ~/.kde4/env/ to ensure it is applied to the entire KDE session.

Simply create an executable script file in there, and it will be automatically sourced ( included ) in very early in the KDE startup process.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
Kryten2X4B
Registered Member
Posts
911
Karma
4
OS

Re: Time zone woes

Tue Nov 16, 2010 9:27 am
glupie wrote:I actually meant that the behavior (inability to
just set the timezone for a user) was worthless,
not your answer.


I realize that so no worries.

glupie wrote:I assume that workaround means initializing the TZ
variable from a shell, and then running the KDE
applications from a shell?


Either that, or symlinking the .kde(4)/share/mytime file to the corresponding file in /usr/share/zoneinfo. In your case, /usr/share/zoneinfo/Europe/Moscow.

glupie wrote:Probably workable, but not elegant. Is there someone
you can ping to take another look at this, given
that the original bug is probably long forgotten (it
does have fifty votes, though :) )?


I'm afraid I have no idea of who that might be. There was someone assigned to the bug, but if he's still involved in KDE I have no idea.

Personally, I would open a new bug for it considering both the age of report and because of the KDE version(s) in question.


OpenSUSE 11.4, 64-bit with KDE 4.6.4
Proud to be a member of KDE forums since 2008-Oct.
glupie
Registered Member
Posts
67
Karma
0
OS

Re: Time zone woes

Tue Nov 16, 2010 10:26 pm
> I suggest setting TZ from ~/.kde4/env/ to ensure it is
> applied to the entire KDE session.

I never heard of that. Is there any good documentation
for its use?

Also, is there any application (or any other way) of
examining the KDE environment variables?

>. Either that, or symlinking the .kde(4)/share/mytime
> file to the corresponding file in /usr/share/zoneinfo.

From reading that bug report, it seems that the "mytime"
file was just given as a (possible) example. with the
environment variable being the important thing (indeed,
it doesn't need to be linked to a file - the system
libraries obtain the information from the zoneinfo file).

> Personally, I would open a new bug for it considering
> both the age of report and because of the KDE version(s)
> in question.

I might do that if I can locate my bugzilla user id and
password.
Kryten2X4B
Registered Member
Posts
911
Karma
4
OS

Re: Time zone woes

Tue Nov 16, 2010 11:42 pm
glupie wrote:Also, is there any application (or any other way) of
examining the KDE environment variables?


export without any parameters will list all known and set environment variables. Of course, only those that actually have been set. It won't list the possible ones that are currently not used.

Unfortunately, I know of no documentation describing the use of the env directory (and I've never had to use it myself) but everytime I've seen it mentioned it has been to set environment variables very early on in the startup-process.

glupie wrote:From reading that bug report, it seems that the "mytime"
file was just given as a (possible) example. with the
environment variable being the important thing (indeed,
it doesn't need to be linked to a file - the system
libraries obtain the information from the zoneinfo file).


Hm, yes. After reading it again I see that it can indeed be interpreted that way as well.


OpenSUSE 11.4, 64-bit with KDE 4.6.4
Proud to be a member of KDE forums since 2008-Oct.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Time zone woes

Wed Nov 17, 2010 3:30 am
Any executable script placed in ~/.kde4/env/ will be sourced by "startkde" prior to the starting of ksmserver and other processes which make a KDE session.

As these scripts are sourced, you can export variables using normal bash syntax, which will then affect the environment variables of all applications started from ksmserver ( which is everything )

If gpg-agent / ssh-agent are not running, this is probably the best place to get them stared and propagate their environment variables.

Code: Select all
export TZ=/path/to/TZ/file


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
Slidemansailor
Registered Member
Posts
4
Karma
0
OS

Re: Time zone woes

Thu May 26, 2011 4:49 pm
I'm just starting with KOrganizer this morning ... and this forum right now.

I cannot seem to find any way to switch to a 24-hour clock as a default in my calendar.

I would much prefer to see my morning appointments show up as 0930 instead of 09:30 AM, and my evening appointments to show up as 1730 instead of 05:30 PM.

Is it possible now? later, perhaps?


P.S. If this is better related to another discussion topic, or answered elsewhere, I apoligize for missing it. I did not really want to start a new topic just in case that was the situation.
User avatar
google01103
Manager
Posts
6668
Karma
25

Re: Time zone woes

Thu May 26, 2011 5:04 pm
systemsettings -> locale -> country region/language -> date and time -> time format -> HH:MM:SS


OpenSuse Leap 42.1 x64, Plasma 5.x

User avatar
Slidemansailor
Registered Member
Posts
4
Karma
0
OS

Re: Time zone woes

Thu May 26, 2011 6:32 pm
I had tried that without success, but your suggesting it made me try again ... harder. I shut down and restarted to find it working just fine.


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot]