<div dir="ltr">Hi,<div><br></div><div>I've implemented support for timezones in timers (at least I am not sure if there are some other places that need some changes).</div><div><br></div><div>Here is a diff of what I've committed so far: <a href="https://github.com/systemd/systemd/compare/master...zerkms:TIMER_TIMEZONE">https://github.com/systemd/systemd/compare/master...zerkms:TIMER_TIMEZONE</a></div><div><br></div><div>In the very bottom in the tests file you may see what is supported and how. In short:</div><div><br></div><div>the IANA timezone name are supported. Basically, any timezone from the `timedatectl list-timezones` output is supported.</div><div><br></div><div>The most basic example of the timer:</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><font face="monospace, monospace">2017-09-09 20:42:00 Pacific/Auckland</font></div></blockquote><div><br></div><div>Implementation takes into account standard/summer time change.</div><div><br></div><div>Implementation might be improved further via a small refactoring to remove the `CalendarSpec::utc` field, since it effectively is not necessary now, given that one may use `spec->timezone = "UTC";` instead.</div><div><br></div><div>I'm looking for your feedback,</div><div><br></div><div>thanks.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 7 September 2017 at 08:12, Ivan Kurnosov <span dir="ltr"><<a href="mailto:zerkms@zerkms.ru" target="_blank">zerkms@zerkms.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'm doing it with the libc and doing it out of the process:<div><br></div><div><a href="https://github.com/zerkms/systemd/blob/d09815ef6df4705e06bd0b3a276c4cbd8630859f/src/basic/calendarspec.c#L902" target="_blank">https://github.com/zerkms/<wbr>systemd/blob/<wbr>d09815ef6df4705e06bd0b3a276c4c<wbr>bd8630859f/src/basic/<wbr>calendarspec.c#L902</a><br></div><div><br></div><div>I believe parsing is portable standard C with libc and time conversion will be very similar to that.</div></div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">On 7 September 2017 at 01:25, Lennart Poettering <span dir="ltr"><<a href="mailto:lennart@poettering.net" target="_blank">lennart@poettering.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On Mi, 06.09.17 13:18, Mantas Mikulėnas (<a href="mailto:grawity@gmail.com" target="_blank">grawity@gmail.com</a>) wrote:<br>
<br>
> On Wed, Sep 6, 2017 at 12:58 PM, Ivan Kurnosov <<a href="mailto:zerkms@zerkms.ru" target="_blank">zerkms@zerkms.ru</a>> wrote:<br>
><br>
> > I've started working on it (as a crazy experiment for myself primarily)<br>
> ><br>
> > At the moment I added support for timezones (IANA) to the `CalendarSpec`,<br>
> > the parser and the formatter.<br>
> ><br>
> > <a href="https://github.com/zerkms/systemd/commit/367325ae7a2c4df2c05" rel="noreferrer" target="_blank">https://github.com/zerkms/syst<wbr>emd/commit/367325ae7a2c4df2c05</a><br>
> > 13e8bb8e9925aaf24feef<br>
> ><br>
><br>
> systemd actually used to have code for parsing *tzdata files* (and showing<br>
> DST information in timedatectl); you might want to find that in Git.<br>
<br>
</span>While it did parse that I don't think we should go that route<br>
here. When converting local time into unix time and back we really<br>
should let the libc deal with that, and not replicate that. it's not<br>
pretty to do this in libc, as there's no way to do time calculation in<br>
a non-default timezone except by manipulating env vars, but it's<br>
doable, as long as we do this out-of-process...<br>
<div class="m_428406061204406107HOEnZb"><div class="m_428406061204406107h5"><br>
Lennart<br>
<br>
--<br>
Lennart Poettering, Red Hat<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div></div></div><span class="">-- <br><div class="m_428406061204406107gmail_signature" data-smartmail="gmail_signature">With best regards, Ivan Kurnosov</div>
</span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">With best regards, Ivan Kurnosov</div>
</div>