<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Jan 21, 2017 at 5:06 AM, David T. Lewis <span dir="ltr"><<a href="mailto:lewis@mail.msen.com" target="_blank">lewis@mail.msen.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
I sent a git pull request for the new primitive, so hopefully you can<br>
review it and include it in SqueakJS if it is not too horrible.</blockquote><div><br></div><div>Awesome! Merged.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
To my considerable surprise, DateAndTime>>now seems to be 70 times faster<br>
on SqueakJS when using this primitive along with the enhancements in the<br>
UTCDateAndTime repository.</blockquote><div><br></div><div>Well, emulating a primitive is a lot more expensive on a slow VM like SqueakJS still is. So I'm not too, surprised, but happy nonetheless :)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I am inexperienced with JavaScript and Git, so in case any of this did not<br>
get through, the proposed new function in Squeak.Primitives is:<br>
<br>
primitiveUtcWithOffset: function(argCount) {<br>
var d = new Date();<br>
var posixMicroseconds = this.pos53BitIntFor(d.getTime(<wbr>) * 1000);<br>
var offset = -60 * d.getTimezoneOffset();<br>
if (argCount > 0) {<br>
// either an Array or a DateAndTime in new UTC format with two ivars<br>
var stWordIndexableObject = this.vm.stackValue(0);<br>
stWordIndexableObject.<wbr>pointers[0] = posixMicroseconds;<br>
stWordIndexableObject.<wbr>pointers[1] = offset;<br>
this.popNandPushIfOK(argCount + 1, stWordIndexableObject);<br>
return true;<br>
}<br>
var timeAndOffset = [<br>
posixMicroseconds,<br>
offset,<br>
];<br>
this.popNandPushIfOK(argCount + 1, this.makeStArray(<wbr>timeAndOffset));<br>
return true;<br>
},<br></blockquote><div> </div></div>It looks fine. We could try to incorporate the microsecondClock function, but if milliseconds are good enough then this will do.</div><div class="gmail_extra"><br></div><div class="gmail_extra">- Bert -</div></div>