How to use a custom timezone?

In short, I don’t like any government being in control of my personal timekeeper. Also, I want to disable summer time altogether, but to my knowledge, there’s no such option in the Sailfish Settings app.

I tried running “echo ‘Zone FST 2:00 - FST’ | zic -” as root and including a reference to the newly created FST (Finnish Standard Time) file in both zone1970.tab and zone.tab at /usr/share/zoneinfo, but selecting the new timezone in Sailfish settings doesn’t actually change the setting; it just keeps the previous value.

Right now, I’m using another country’s timezone because I found one that stays at UTC+2 all through the year (Egypt), but that’s really not a solution at all.

I have no problem applying the custom timezone on my Linux desktop using timedatectl, it just doesn’t work on Sailfish using the Settings app. I don’t know if you can use timedatectl on Sailfish Koli, the tool doesn’t seem to come preinstalled and I couldn’t find it in the default repositories so I can’t really test it.

By the way, I also want to make Android apps on Sailfish adhere to my custom timezone. Are there any extra steps to accomplish that?

I thought it would make more sense for me if the time was location-agnostic and user-adjustable but still able to be automatically synced with the network, say, once a week.

I also tried using the preinstalled UTC and GMT timezone files, but it resulted in the same as with my custom timezone. However, the preinstalled EET and CET files do work. Inspecting these binary files makes me think that Sailfish is expecting some extra definition that’s not present in the nonworking files.

For anyone who’s wondering, if I want to know the local time I can just use a world clock.

The timezone selection goes via timed, and it rejects timezones that are not listed in /usr/share/tzdata-timed/zone.alias - you could check if adding “FST” line in there and restarting timed-qt5.service makes a difference.

Alternatively you should be able to select UTC+2 time by selecting GMT-2 timezone from command line:

timedclient-qt5 --set-info=timeNitz --set-info=timezoneManual=Etc/GMT-2

Unfortunately there seems to be some hiccup in generating/parsing zone.alias too - “GMT-2” is taken to be an alias for “Iso8601/+0200” when it should be the other way around (I filed a bug about this). Can be worked around (needs root) with:

devel-su
mkdir -p /usr/share/zoneinfo/Iso8601
cd /usr/share/zoneinfo/Iso8601
ln -s -- ../Etc/GMT-2 +0200

After which the above timedclient invocation should succeed.

1 Like

That’s pretty interesting. Using your method, I managed to switch to different timezones like Etc/GMT-2 and FST. I had to create another symlink using the same logic so I could switch to UTC. (I’d like to see if these custom timezones could be made more descriptive in the Settings UI so it would show something else instead of a blank city/country name.)

Any way to get automatic syncing to work?

Thanks.

Yes, that earlier timedclient example should enable automatic time sync:

timedclient-qt5 --set-info=timeNitz --set-info=timezoneManual=Etc/GMT-2

Note that despite the name, automatic time sync both uses cellular NITZ data when available and enables NTP client (in connman).

It can be turned off from settings (but turning it back on also restores automatically chosen tz), or via:

timedclient-qt5 --set-info=timeManual --set-info=timezoneManual=Etc/GMT-2

Ah, thanks for clearing that up. Based on my initial testing, this method seems to also work for Android apps.

@spiiroin, are you sure it’s a bug? Reading through IANA’s timezone data at https://data.iana.org/time-zones/tzdb-2021a/etcetera makes it look like a POSIX thing. Is this what you were talking about?

I just figured out how to give custom zones their names so it looks good in the UI. I’ll keep you updated…

No, what I meant is that in zone.alias file there are lines like:

name1 name2 name3 ...

When timed is reading the file it takes the first item to be the “real” timezone and the rest are aliases for it i.e. requesting “name2” is allowed and datafile for “name1” is used.

Now, what happens in case of

Iso8601/+0200 Iso8601/+02 Iso8601/+02:00 Etc/GMT-2

Is that “Etc/GMT-2” is a valid timezone. It is an alias for “Iso8601/+0200” -> so far, so good. There is no data file associated with “Iso8601/+0200” -> rejected. Since there is data for GMT-2, this is a false negative.

Solution could be: a) fix zone.alias generator so that it ensures names with data are first, or b) fix zone.alias parser so that it does not blindly assume that the fist item has data.

And that workaround: makes it so that “Iso8601/+0200” has data by creating a symlink to “Etc/GMT-2” data that is available.

Alright, makes sense.

I figured some people might want an update by now, so here it is. I’ve done some research on ways to integrate custom timezones with Sailfish settings, and I’ve almost finished writing a tutorial / bash script to easily install or uninstall a couple of custom timezones. I’ve got a few screenshots coming too.

1 Like

@timekeeper341 Just FYI: option (b) fix is here: https://git.sailfishos.org/mer-core/timed/merge_requests/26

1 Like