[erlang-questions] Timezone calculations

Juan Jose Comellas <>
Fri Sep 19 00:36:44 CEST 2008

That may work but it's really not suitable for lots of calculations. It
might be even better to use a hardcoded set of offsets or bite the bullet
and parse the zoneinfo files myself.

What is the best way to create bindings to the C functions that provide this
functionality in libc? Is it worth it to create a linked in driver for this?
What is the simplest way to create C bindings to lightweight functions that
have a very low risk of crashing the Erlang VM?

On Thu, Sep 18, 2008 at 5:03 PM, Taavi Talvik <> wrote:

> On Sep 18, 2008, at 10:18 PM, Juan Jose Comellas wrote:
>  I need to perform time calculations based on arbitrary (user-supplied)
>> timezones and I haven't found anything in Erlang/OTP that lets me determine
>> the offset (in minutes or seconds) that a timezone has against UTC. The
>> calendar module only supports converting times from UTC into the local
>> timezone and the other way around, but what if what I want is to convert a
>> time to another timezone that is not my local one?
>> I'd prefer a portable solution, but even if there is an easy way to access
>> the Olson/zoneinfo tz database on Linux that would be acceptable.
> os:cmd("date args..").
> It is reasonably easy to run existing external tools from erlang and
> capture results.
> Reimplementing everything probably does not make sense.
> best regards,
> taavi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080918/7b9e1ec5/attachment.html>

More information about the erlang-questions mailing list