<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 04/05/2013 11:41 AM, Simon Smithies
wrote:<br>
</div>
<blockquote
cite="mid:CADkyPQf-rNjgGAQEf+S_mgLGc8ek0eznajLiOqEOb=s7N7CqSw@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<div dir="ltr">
<div style="">Hi, </div>
<div><br>
</div>
<div style="">Erlang newbie here ...</div>
<div><br>
</div>
I have two Debian linux VPSs, both largely identical except for
Erlang versions, running in Virtuozzo containers with the same
provider.
<div>
<br>
</div>
<div style="">On the VPS running Erlang R14B04, erlang:now() and
erlang:localtime() return identical results (as they do on my
local machine, and some others we've tried):</div>
<div style="">
<div>1> {calendar:now_to_local_time(erlang:now()),
erlang:localtime()}.</div>
<div>{{{2013,4,5},{22,12,57}},{{2013,4,5},{22,12,57}}}</div>
<div><br>
</div>
<div style="">On the other VPS however, running Erlang R15B01,
I get different results:</div>
<div style="">
<div>1> {calendar:now_to_local_time(erlang:now()),
erlang:localtime()}. </div>
<div>{{{2013,4,5},{22,35,29}},{{2013,4,5},{22,30,29}}}</div>
</div>
<div style=""><br>
</div>
<div style="">As background, I'm running Zotonic on both VPSs;
on the R15B01 machine Zotonic is being regularly restarted
by the heart process -- every 5 minutes. Have been talking
to the Zotonic people about this, and in the absence of a
better explanation, we're thinking this time difference
might be the cause. </div>
<div style=""><br>
</div>
</div>
</div>
</blockquote>
This has probably nothing to do with the windows bug. If the two
values (now() and localtime()) differ, it's usually because the wall
clock time on the system has been adjusted after Erlang was started.
(by NTP or a manual time adjustment). If the system restarts, it may
have a slightly skewed time at start and then it's adjusted by some
means. erlang:now() has to slowly adapt to the new world if you set
the time. The realtime properties requires that time in the system
does not jump, but you would not want now() and localtime() to move
away from each other, why now() slowly adjusts. In this case, now()
will move 1% slower until it converges with the localtime(), which
means that it takes 500 minutes before they are in sync.<br>
<br>
Setting the time to a correct value before starting Erlang is the
solution if this is not acceptable.<br>
<br>
Try starting another node on the Zotonic, or restarting Erlang, and
you should see similar times. Or try syncing the time before Erlang
starts (ntpdate). You should also be able to see in files like
/var/log/messages that the wall clock jumps.<br>
<blockquote
cite="mid:CADkyPQf-rNjgGAQEf+S_mgLGc8ek0eznajLiOqEOb=s7N7CqSw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div style="">
<div style="">Anyway, logging here as the difference seems
like a bug in Erlang.</div>
<div style=""><br>
</div>
<div style="">- Simon <br>
</div>
</div>
</div>
</blockquote>
Cheers,<br>
/Patrik<br>
<blockquote
cite="mid:CADkyPQf-rNjgGAQEf+S_mgLGc8ek0eznajLiOqEOb=s7N7CqSw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div style="">
<div style=""><br>
</div>
<div style=""><br>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
erlang-bugs mailing list
<a class="moz-txt-link-abbreviated" href="mailto:erlang-bugs@erlang.org">erlang-bugs@erlang.org</a>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-bugs">http://erlang.org/mailman/listinfo/erlang-bugs</a>
</pre>
</blockquote>
<br>
</body>
</html>