Re: [systemd-devel] Specifying calendar events in an arbitrary timezone

2016-12-15 Thread Mantas Mikulėnas
Ah, systemd in fact had tzdata parsing code already – it was used by
tinedatectl to show DST info. Try to recover it from Git.

On Thu, Dec 15, 2016, 21:03 Ran Benita  wrote:

> On Thu, Dec 15, 2016 at 06:35:15PM +0100, Lennart Poettering wrote:
> > So yeah, we'd love to support this, but are waiting for a suitable API.
>
> I see, makes sense.
>
> Since new glibc API will probably be slow to come, if ever, it might
> make sense to circumvent it and go for the tzdata directly? It seems the
> format is described in tzfile(5), and the glibc code which handles it
> seems to be public domain as well: https://github.com/eggert/tz
> I don't have any experience with those APIs, though.
>
> If I get some time I'll try and see if such an approach is viable.
>
> Thanks!
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
-- 

Mantas Mikulėnas 
Sent from my phone
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Specifying calendar events in an arbitrary timezone

2016-12-15 Thread Ran Benita
On Thu, Dec 15, 2016 at 06:35:15PM +0100, Lennart Poettering wrote:
> So yeah, we'd love to support this, but are waiting for a suitable API.

I see, makes sense.

Since new glibc API will probably be slow to come, if ever, it might
make sense to circumvent it and go for the tzdata directly? It seems the
format is described in tzfile(5), and the glibc code which handles it
seems to be public domain as well: https://github.com/eggert/tz
I don't have any experience with those APIs, though.

If I get some time I'll try and see if such an approach is viable.

Thanks!
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Specifying calendar events in an arbitrary timezone

2016-12-15 Thread Lennart Poettering
On Thu, 15.12.16 17:52, Ran Benita (ran...@gmail.com) wrote:

> My question: is this not supported on purpose (because timezones suck),
> or because it's just not implemented/hard to implement?

Current systemd actually supports calendar events with timezone
specifications. However, the specified time zone must either be "UTC"
or identical to the one configured in /etc/localtime, which doesn't
make it particularly useful I guess (the reason we support this is so
that any timestamp we spit out can also be parsed againt as calendar
event specification, and out timestamps after all do include a
timezone specification).

We'd love to support any kind of timezone specifications, but glibc
does not offer a suitable API for that. We could change around the $TZ
env var all the time when doing time calculations, but that's just
awful.

For most locale-dependent function calls glibc nowadays provides
"locale_t" arguments in order to run them with a different locale. It
would be great if it had a matching "timezone_t" type or so which
would allow running time-specific functions with a different timezone.

So yeah, we'd love to support this, but are waiting for a suitable API.

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel