<br><br><div class="gmail_quote">On Tue, Jun 19, 2012 at 1:50 PM, Igor Stasenko <span dir="ltr">&lt;<a href="mailto:siguctua@gmail.com" target="_blank">siguctua@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
IMO epoch starting is completely orthogonal to timezone bug which<br>
should simply fixed.<br>
If you define epoch time as 1 jan 1970 (or any other date you prefer)<br>
but still will mess up with timezones, it won&#39;t change anything isn&#39;t?<br></blockquote><div><br></div><div>+1.  In Cog the VM has a 64-bit microsecond clock which is available both as microseconds from 1901 UTC and in local time.   This is a great basis as it eliminates millisecond clock rollover issues (every 49 days?), lasts for &gt; 50,000 years, and needs only the one primitive to answerUTC in up to microsecond resolution, fully synchronised.  VW has been using such a basis for about a decade.  If we could add these time primtiievs to the Interpreter IMO we&#39;d have a much better basis for time.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
<br>
On 19 June 2012 21:53, Sean P. DeNigris &lt;<a href="mailto:sean@clipperadams.com">sean@clipperadams.com</a>&gt; wrote:<br>
&gt; I wrote some tests to show the broken behavior. I&#39;m attaching them to the<br>
&gt; issue and<br>
&gt; <a href="http://forum.world.st/file/n4635557/DateAndTimeTest-test_-_epoch.st" target="_blank">http://forum.world.st/file/n4635557/DateAndTimeTest-test_-_epoch.st</a> to<br>
&gt; Nabble . Comments inline below...<br>
&gt;<br>
&gt;<br>
&gt; Eliot Miranda-2 wrote<br>
&gt;&gt;<br>
&gt;&gt;&gt;  We recently agreed that the Squeak epoch was well-defined, i.e. the<br>
&gt;&gt;&gt; start of the 20th century in GMT.  This is clear if you read the<br>
&gt;&gt;&gt; SMalltalk-80 V2 sources.  The reason advanced for changing to Unix was<br>
&gt;&gt;&gt; that the Squeak epoch is not well-defined.  That argument is incorrect.<br>
&gt;&gt;<br>
&gt;<br>
&gt; My understanding of what we found was that ST-80 referenced GMT, but Squeak<br>
&gt; was cloudy (IMO wrong) from the beginning [1]. However, the actual constant<br>
&gt; SqueakEpoch is actually a number of julian days, so that *could* stay<br>
&gt; unchanged if we decide that way.<br>
&gt;<br>
&gt; [1]<br>
&gt; <a href="http://forum.world.st/Re-Pharo-project-Epoch-returns-local-offset-tp4630581p4630834.html" target="_blank">http://forum.world.st/Re-Pharo-project-Epoch-returns-local-offset-tp4630581p4630834.html</a><br>
&gt;<br>
&gt;<br>
&gt; Eliot Miranda-2 wrote<br>
&gt;&gt;<br>
&gt;&gt;&gt; Further, the Squeak epoch is embedded in the VMs, in their answering both<br>
&gt;&gt;&gt; seconds and microseconds from the epoch.  So there&#39;s work involved in<br>
&gt;&gt;&gt; getting rid of it.<br>
&gt;&gt;<br>
&gt; This test indicates to me that the VM is using the same (wrong) logic as the<br>
&gt; image:<br>
&gt;    testSqueakEpochClock<br>
&gt;<br>
&gt;        | secondsFromClock secondsSinceEpochUTC |<br>
&gt;        self useTimeZone: &#39;EDT&#39; during: [<br>
&gt;                secondsFromClock := Time primSecondsClock.<br>
&gt;                secondsSinceEpochUTC := (DateAndTime now - &#39;1901-01-01T00:00:00+00:00&#39;<br>
&gt; asDateAndTime) asSeconds.<br>
&gt;<br>
&gt;                &quot;Fails because the clock returns the number of seconds since<br>
&gt; 1901-01-01T00:00:00+(localOffset)&quot;<br>
&gt;                self deny: secondsFromClock = (secondsSinceEpochUTC + DateAndTime<br>
&gt; localOffset asSeconds).<br>
&gt;                self assert: secondsFromClock equals: secondsSinceEpochUTC ].<br>
&gt;<br>
&gt;<br>
&gt; Stéphane Ducasse wrote<br>
&gt;&gt;<br>
&gt;&gt; Now Sean what was your problem? Because may be we can also improve<br>
&gt;&gt; Squeak-epoch.<br>
&gt;&gt;<br>
&gt; Any time a DateAndTime is converted to seconds, the result is &quot;the number of<br>
&gt; seconds since 1901-01-01T00:00:00+(localOffset)&quot;, which is indeterminate.<br>
&gt; For example (see #testSqueakEpochAcrossTimeZones):<br>
&gt; 1. aDateAndTime asSeconds.<br>
&gt; 2. quit the image<br>
&gt; 3. move to a different time zone (or set localTimeZone: to a different tz)<br>
&gt; 4. open the image again<br>
&gt; 5. restore the DateAndTime e.g. #fromSeconds:<br>
&gt; It is a different DateAndTime!!<br>
&gt;<br>
&gt; I&#39;m clear (but please review the tests) that whatever epoch we choose:<br>
&gt; - the implementation *around* it must be fixed<br>
&gt; - the VM should be changed<br>
&gt; - any existing integers representing DateAndTime&#39;s will be invalid<br>
&gt;<br>
&gt; I think the only reason we&#39;ve gotten this far without anyone noticing is<br>
&gt; that they are converted to/from integers in the same incorrect way in both<br>
&gt; directions, so unless you transport live instances into a different time<br>
&gt; zone, you would never notice.<br>
&gt;<br>
&gt; The only question that I see we&#39;ve come down to is:<br>
&gt; - keep the Squeak epoch, because it is elegant (turn of the century...)<br>
&gt; or<br>
&gt; - use the Unix epoch, because it is well-known and documented<br>
&gt; This is honestly much less important than the givens above, so this is what<br>
&gt; I&#39;ll do... I&#39;m going to create a new issue and to fix the image-side issues<br>
&gt; I mentioned, and we can have fun debating this last question, which seems to<br>
&gt; come down to style, ad infinitum ;-)<br>
&gt;<br>
&gt; Sean<br>
&gt;<br>
&gt; --<br>
&gt; View this message in context: <a href="http://forum.world.st/who-can-have-a-look-at-Issue-5913-Remove-Squeak-epoch-tp4634003p4635557.html" target="_blank">http://forum.world.st/who-can-have-a-look-at-Issue-5913-Remove-Squeak-epoch-tp4634003p4635557.html</a><br>

&gt; Sent from the Pharo Smalltalk mailing list archive at Nabble.com.<br>
&gt;<br>
<br>
<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Best regards,<br>
Igor Stasenko.<br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div><br>