On Wed, Nov 18, 2009 at 8:28 AM, Koen Deforche <[email protected]> wrote:

> Note that you are free to modify any part of the widget hierarchy (or
> models used by the widgets) outside the event loop as long as you
> register your attach your thread to the application instance and grab
> the application's update lock (in WApplication: attachThread() and
> updateLock()). These modifications will be synchronized with the
> browser on the next event, so you could for example chose to attach to
> the WTimer a no-op call back routine.

Speaking about WTimer, I think its implementation is wrong on Unix and
could be more precise on Windows (although I'm not sure more precision
is required; I've not checked if Wt::Time is used server-side).

Files affected are
src/http/Reply.C (only Unix)
src/web/TimeUtil.C (Unix and Windows)

Problems:

- On Unix, gettimeofday is used. If you change the computer time (move
it 1 hour forward or backward to test), you'll get wrong results
because gettimeofday. The way to prevent this is to use clock_gettime
with CLOCK_MONOTONIC. On Linux with modern glibc, this requires
linking to librt (glibc 2.7 did not require explicit linking to librt,
glibc 2.9 does; I don't have glibc 2.8 here to test). On FreeBSD
(including Mac, IIRC) you don't need to link to librt.

- On Windows, timeGetTime() is used. It'd be better if you used
GetTickCount or QueryPerformanceFrequency, it's more precise. Further,
I have not tested timeGetTime for the above issue (changing the
computer clock) but I have used both GetTickCount and
QueryPerformacequery and they work fine.

I don't have time to fix this because I'm very busy with other stuff
now but you can take a look at
http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/src/osg/Timer.cpp
for one place where I already fixed this.

As a consolation, 99% of software projects are biten by this issue.
I'll blog on this soon.

-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to