Erlang/OTP Forums

Author Message

<  Erlang patches mailing list  ~  Bug with localtime_r()?

rich.neswold at gmail.com
Posted: Wed Jun 15, 2005 12:31 pm Reply with quote
Guest
Hello,

I'm running R10B-5 on my NetBSD 2.0.2 system. I noticed that
erlang:localtime() was returning UTC time. It turns out that
'configure' detects localtime_r() on my system and uses it. However,
on NetBSD, the man page says:

"localtime_r() does not imply initialization of the local time conversion
information; the application may need to do so by calling tzset(3)."

Looking through the BEAM source, I couldn't find any reference to
tzset(3) so I added it to the emulator initialization. The man page
didn't seem to imply that each thread needed to call it, so I didn't
try to put tzset() in the process initialization code.

I rebuilt my OTP installation using the following patch, and now the
localtime functions work:

--- erts/emulator/sys/unix/sys.c.orig 2005-06-14 23:25:38.000000000 -0500
+++ erts/emulator/sys/unix/sys.c 2005-06-14 23:28:11.000000000 -0500
_at__at_ -33,6 +33,10 _at__at_
#include <ctype.h>
#include <sys/utsname.h>

+#ifdef HAVE_LOCALTIME_R
+#include <time.h>
+#endif
+
#if !defined(USE_SELECT)

# ifdef HAVE_POLL_H
_at__at_ -428,6 +432,9 _at__at_
if (isatty(0)) {
tcgetattr(0,&initial_tty_mode);
}
+#ifdef HAVE_LOCALTIME_R
+ tzset();
+#endif
}

--
Rich

AIM : rnezzy
ICQ : 174908475


Post generated using Mail2Forum (http://m2f.sourceforge.net)
rich.neswold at gmail.com
Posted: Thu Jun 16, 2005 4:15 pm Reply with quote
Guest
On 6/15/05, Rich Neswold <rich.neswold_at_gmail.com> wrote:
> I rebuilt my OTP installation using the following patch, and now the
> localtime functions work:

Sorry for the extra traffic, but I wasn't subscribed to the -patches
mailing list (I am now.) I missed the replies (if any) to my patch and
there doesn't appear to be an archive for -patches.

If there was an response, could the author please resend it to me
directly? I'll then be caught up and subscribed. Thanks!

--
Rich

AIM : rnezzy
ICQ : 174908475


Post generated using Mail2Forum (http://m2f.sourceforge.net)
raimo at erix.ericsson.se
Posted: Fri Jun 17, 2005 7:49 am Reply with quote
Guest
Sorry, there was no response, but here it comes!

We did not manage to get it into R10B-6 about to be released, but
it will be in the next release. We have to make some modifications
and test thoroughly that it does not break anything on any of our
commercial platforms.
--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB


Post generated using Mail2Forum (http://m2f.sourceforge.net)
daniel.neri at gmail.com
Posted: Fri Jun 17, 2005 8:38 am Reply with quote
Guest
On 16/06/05, Rich Neswold <rich.neswold_at_gmail.com> wrote:

> there doesn't appear to be an archive for -patches.

There is an archive, but it's not linked from the contact page:

http://www.erlang.org/ml-archive/erlang-patches/

It's also available on Gmane (HTTP or NNTP):

http://news.gmane.org/gmane.comp.lang.erlang.patches/


Regards,
--
Daniel N
rich.neswold at gmail.com
Posted: Fri Jun 17, 2005 2:25 pm Reply with quote
Guest
On 6/17/05, Daniel N
rich.neswold at gmail.com
Posted: Fri Jun 17, 2005 2:29 pm Reply with quote
Guest
On 17 Jun 2005 09:25:20 +0200, Raimo Niskanen <raimo_at_erix.ericsson.se> wrote:
> We did not manage to get it into R10B-6 about to be released, but
> it will be in the next release. We have to make some modifications
> and test thoroughly that it does not break anything on any of our
> commercial platforms.

Sounds good! Thanks!

--
Rich

AIM : rnezzy
ICQ : 174908475


Post generated using Mail2Forum (http://m2f.sourceforge.net)

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum