David T. Lewis uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-dtl.476.mcz ==================== Summary ==================== Name: Kernel-dtl.476 Author: dtl Time: 14 August 2010, 5:55:49.082 pm UUID: ac94bcb6-d6bc-4863-b7a8-70d7f49b81e2 Ancestors: Kernel-eem.475 Add Time class>>primMicrosecondClock and Time class>>primUtcWithOffset for access to microsecond clock primitives available in newer Squeak VMs. primMicrosecondClock provides a system clock with nominal microsecond precision. primUtcWithOffset answers UTC time as microseconds since the Posix epoch and offset as seconds offset from GMT. The Squeak clock is traditionally implemented in terms of platform local time. Use of UTC time and offset is advantageous if time zones and daylight saving time offsets are to be considered. Example: { Time primMillisecondClock . Time primMicrosecondClock . Time primUtcWithOffset } ==> #(6932757 6932757830 #(1281815075538304 -14400)) =============== Diff against Kernel-eem.475 =============== Item was added: + ----- Method: Time class>>primMicrosecondClock (in category 'clock') ----- + primMicrosecondClock + "Answer the number of microseconds since the microsecond clock + was last reset or rolled over. Answer zero if the primitive fails." + + <primitive: 'primitiveMicrosecondClock'> + ^ 0! Item was added: + ----- Method: Time class>>primUtcWithOffset (in category 'clock') ----- + primUtcWithOffset + "Answer an array with UTC microseconds since the Posix epoch and + the current seconds offset from GMT in the local time zone." + + <primitive: 'primitiveUtcWithOffset'> + ^ { 0 . 0 }! |
I wonder why we have to create a conflict between the Cog and Squeak VMs at this point... As I understand it primitiveMicrosecondClock has a different epoch (posix, 1970) which strikes me as unnecessary. Can't we keep with 64-bit microseconds from the Squeak epoch?
best Eliot
On Sat, Aug 14, 2010 at 2:56 PM, <[hidden email]> wrote: David T. Lewis uploaded a new version of Kernel to project The Trunk: |
Neither primitiveMillisecondClock nor primitiveMicrosecondClock is implemented
relative to an epoch value. On a Linux system, they produce values like this: { Time primMillisecondClock . Time primMicrosecondClock } ==> #(38019 38019768) In other words, the microsecond version is like the millisecond prim but with three more digits of precision. The UTC with offset primitive is another thing entirely. It reports time relative to the Posix epoch. It would be good if these two new primitives could be added to the Cog VM at some point, although there is no immediate need to do so. Background and change sets are on Mantis 7458 "[Vm-dev] microsecond timing for GC work". Dave On Sat, Aug 14, 2010 at 05:36:06PM -0700, Eliot Miranda wrote: > I wonder why we have to create a conflict between the Cog and Squeak VMs at > this point... As I understand it primitiveMicrosecondClock has a different > epoch (posix, 1970) which strikes me as unnecessary. Can't we keep with > 64-bit microseconds from the Squeak epoch? > > best > Eliot > > On Sat, Aug 14, 2010 at 2:56 PM, <[hidden email]> wrote: > > > David T. Lewis uploaded a new version of Kernel to project The Trunk: > > http://source.squeak.org/trunk/Kernel-dtl.476.mcz > > > > ==================== Summary ==================== > > > > Name: Kernel-dtl.476 > > Author: dtl > > Time: 14 August 2010, 5:55:49.082 pm > > UUID: ac94bcb6-d6bc-4863-b7a8-70d7f49b81e2 > > Ancestors: Kernel-eem.475 > > > > Add Time class>>primMicrosecondClock and Time class>>primUtcWithOffset for > > access to microsecond clock primitives available in newer Squeak VMs. > > > > primMicrosecondClock provides a system clock with nominal microsecond > > precision. > > > > primUtcWithOffset answers UTC time as microseconds since the Posix epoch > > and offset as seconds offset from GMT. The Squeak clock is traditionally > > implemented in terms of platform local time. Use of UTC time and offset is > > advantageous if time zones and daylight saving time offsets are to be > > considered. > > > > Example: > > { Time primMillisecondClock . > > Time primMicrosecondClock . > > Time primUtcWithOffset } ==> #(6932757 6932757830 #(1281815075538304 > > -14400)) > > > > > > =============== Diff against Kernel-eem.475 =============== > > > > Item was added: > > + ----- Method: Time class>>primMicrosecondClock (in category 'clock') > > ----- > > + primMicrosecondClock > > + "Answer the number of microseconds since the microsecond clock > > + was last reset or rolled over. Answer zero if the primitive fails." > > + > > + <primitive: 'primitiveMicrosecondClock'> > > + ^ 0! > > > > Item was added: > > + ----- Method: Time class>>primUtcWithOffset (in category 'clock') ----- > > + primUtcWithOffset > > + "Answer an array with UTC microseconds since the Posix epoch and > > + the current seconds offset from GMT in the local time zone." > > + > > + <primitive: 'primitiveUtcWithOffset'> > > + ^ { 0 . 0 }! > > > > > > > |
Free forum by Nabble | Edit this page |