lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Systemd about as OS dependent as it gets, definitely off-limits in a
language implementation that's trying to run on more than recent Linux
builds.
In my experience, once a program needs to do things like switching
timezones on the fly you're likely to have to handle multiple time
zones, and then localtime_r is inadequate anyway.


On Mon, Nov 3, 2014 at 1:39 PM, Daurnimator <quae@daurnimator.com> wrote:
> On 3 November 2014 16:28, Gé Weijers <ge@weijers.org> wrote:
>>
>> The downside of this approach is that you end up processing a zoneinfo
>> file each time you just intend to call localtime/localtime_r.
>> Depending on the time zone that can take a substantial amount of time.
>> The zoneinfo files for Cairo, Chile and Jerusalem are over 8K on my
>> system.
>>
>> To use tzset and localtime_r correctly in a multi-threaded environment
>> it is probably necessary to use a read/write lock or similar to make
>> sure no localtime_r call is in progress while tzset is parsing the
>> zoneinfo file.
>>
>> Gé
>
>
> This is why things like 'timedated' exist.
> If you're on a system with it available, you can subscribe to the
> 'PropertyChanged' signal on the 'timezone' property, and react to it.
> http://www.freedesktop.org/wiki/Software/systemd/timedated/



-- 
Gé