Hi!
We identified a bug concerning either the #timeStamp in MorphicEvent objects or Time >> #millisecondClockValue.
Inspecting the result of "ActiveEvent timeStamp - Time millisecondClockValue" returns a suspiciously high number. 21373801 on my last try.
So, the primitive 135, which is used for #millisecondClockValue, points (cointerp.c) to ioMSecs(). For Windows this is "GetTickCount() &0x3FFFFFFF;" (sqWin32Time.C).
Then, the keyboard event (here: CMD+P) gets its timeStamp assigned from the MSG structure in sqWin32Window.c, which is good:
int recordKeyboardEvent(MSG *msg) { ... evt->timeStamp = msg->time; ... }
((( Only for drag/drop events into the VM, it uses ioMicroMSecs() [cointerp.c], which is timeGetTime() and has a higher accuracy. )))
The MSDN says this: MSG structure https://msdn.microsoft.com/en-us/library/windows/desktop/ms644958%28v=vs.85%... GetTickCount() https://msdn.microsoft.com/en-us/library/windows/desktop/ms724408%28v=vs.85%... GetMessageTime() https://msdn.microsoft.com/en-us/library/windows/desktop/ms644939%28v=vs.85%...
And some interesting discussions about msg->time vs. GetMessageTime() : http://blogs.msdn.com/b/oldnewthing/archive/2014/01/22/10491576.aspx
Some ideas/questions:
- Why isn't the MillisecondClockMask applied to the message time as in sqMacUIEvents.c ? - Hmmmm....
Best, Marcel & Bert
-- View this message in context: http://forum.world.st/win32-Morphic-event-timeStamp-bug-tp4824244.html Sent from the Squeak VM mailing list archive at Nabble.com.
Well, it seems that either GetTickCount() does not return the time elapsed since system - not process - start, or that the Windows CogVM does use another version of ioMSecs(), which I cannot spot in the sources.
This, I found in sqWin32Time.c:
int ioMSecs() { /* Make sure the value fits into Squeak SmallIntegers */ #ifndef _WIN32_WCE return timeGetTime() & 0x3FFFFFFF; #else return GetTickCount() &0x3FFFFFFF; #endif }
There also is a function declaration in sq.h:
sqInt ioMSecs(void);
But I cannot spot the default definition/macro as the comment says:
" ... By default, the basic ioMSec() clock function is defined here as a macro based on the standard C library function clock(). ..."
Maybe the comment is outdated... or my sources. :D
Is there a difference between sqInt and int?
Best, Marcel
-- View this message in context: http://forum.world.st/win32-Morphic-event-timeStamp-bug-tp4824244p4824259.ht... Sent from the Squeak VM mailing list archive at Nabble.com.
Mea culpa. Of course, it's an "ndef" and thus the VM should use timeGetTime() under Win32.
https://msdn.microsoft.com/de-de/library/windows/desktop/dd757629%28v=vs.85%...
Best, Marcel
-- View this message in context: http://forum.world.st/win32-Morphic-event-timeStamp-bug-tp4824244p4824269.ht... Sent from the Squeak VM mailing list archive at Nabble.com.
Okay, it seems that the Win32 build of CogVM uses clock() from time.h. Because this function returns the time since process start -- not system start.
Events, however, get their timeStamp from the MSG structure, which is correct.
Why does this happen? Eliot? =D
Best, Marcel
-- View this message in context: http://forum.world.st/win32-Morphic-event-timeStamp-bug-tp4824244p4824282.ht... Sent from the Squeak VM mailing list archive at Nabble.com.
Okay, I got confused with the sqWin32Time.c, which is of no use for the StackVMs.
However, here is a fix. But I am not sure, whether baseTick or vmThreadBaseTick are the offests to use.
sqWin32Heartbeat.h http://forum.world.st/file/n4824333/sqWin32Heartbeat.h sqWin32Heartbeat.c http://forum.world.st/file/n4824333/sqWin32Heartbeat.c sqWin32Window.c http://forum.world.st/file/n4824333/sqWin32Window.c
Best, Marcel
-- View this message in context: http://forum.world.st/win32-Morphic-event-timeStamp-bug-tp4824244p4824333.ht... Sent from the Squeak VM mailing list archive at Nabble.com.
Ahh, I messed it up for the recordDragDropEvent(..). That time was correct.
Eliot, could you check that fix for me, add the proper guards for the non-stack VM (in sqWin32Time.c) and add it to the VM? Pleeeeaaaase? ^___^
Best, Marcel
-- View this message in context: http://forum.world.st/win32-Morphic-event-timeStamp-bug-tp4824244p4824696.ht... Sent from the Squeak VM mailing list archive at Nabble.com.
*bump*
Still broken in the recent CogVMs.
Best, Marcel
-- View this message in context: http://forum.world.st/win32-Morphic-event-timeStamp-bug-tp4824244p4850228.ht... Sent from the Squeak VM mailing list archive at Nabble.com.
vm-dev@lists.squeakfoundation.org