
Just out of interest, what is the problem that prevents the date-time library from implementing a microsecond clock using GetSystemTimeAsFileTime on Win32? Thanks, John.

On Sat, 24 Jul 2004 11:24:39 +0100, John Maddock wrote
Just out of interest, what is the problem that prevents the date-time library from implementing a microsecond clock using GetSystemTimeAsFileTime on Win32?
Nothing except time and motivation of the author ;-) I've been meaning to get around to it for quite some time now, but it just hasn't made it off the todo stack -- partially because I haven't had a need for it personally. Jeff

At Saturday 2004-07-24 08:12, you wrote:
On Sat, 24 Jul 2004 11:24:39 +0100, John Maddock wrote
Just out of interest, what is the problem that prevents the date-time library from implementing a microsecond clock using GetSystemTimeAsFileTime on Win32?
Nothing except time and motivation of the author ;-) I've been meaning to get around to it for quite some time now, but it just hasn't made it off the todo stack -- partially because I haven't had a need for it personally.
having the test blame the compiler it a tad tacky, don'tcha think?
Jeff _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Victor A. Wagner Jr. http://rudbek.com The five most dangerous words in the English language: "There oughta be a law"

On Sun, 25 Jul 2004 01:13:04 -0700, Victor A. Wagner Jr. wrote
At Saturday 2004-07-24 08:12, you wrote:
On Sat, 24 Jul 2004 11:24:39 +0100, John Maddock wrote
Just out of interest, what is the problem that prevents the date-time library from implementing a microsecond clock using GetSystemTimeAsFileTime on Win32?
Nothing except time and motivation of the author ;-) I've been meaning to get around to it for quite some time now, but it just hasn't made it off the todo stack -- partially because I haven't had a need for it personally.
having the test blame the compiler it a tad tacky, don'tcha think?
Well, I agree the comment is misleading -- it's the library not the compiler. A correct implementation the POSIX C API's would solve the issue with no work on my part. But I think the main point is clear -- if you compile and run this test you get a message it isn't supported by this platform for the time being. Jeff

On Sun, 25 Jul 2004 04:27:05 -0700, Jeff Garland wrote
On Sun, 25 Jul 2004 01:13:04 -0700, Victor A. Wagner Jr. wrote
At Saturday 2004-07-24 08:12, you wrote:
On Sat, 24 Jul 2004 11:24:39 +0100, John Maddock wrote
Just out of interest, what is the problem that prevents the date-time library from implementing a microsecond clock using GetSystemTimeAsFileTime on Win32?
Nothing except time and motivation of the author ;-) I've been meaning to get around to it for quite some time now, but it just hasn't made it off the todo stack -- partially because I haven't had a need for it personally.
having the test blame the compiler it a tad tacky, don'tcha think?
Well, I agree the comment is misleading -- it's the library not the compiler. A correct implementation the POSIX C API's would solve the issue with no work on my part. But I think the main point is clear -- if you compile and run this test you get a message it isn't supported by this platform for the time being.
One more minor point: the latest versions of Intel and Codewarrior apparently now support this function on Win32 -- at least of the meta-comm results are to be believed. Look under 'sslapeta' at http://www.meta-comm.com/engineering/boost-regression/developer/date_time.ht... I'm pretty sure gcc under cygwin works as well. So it seems conceivable that other vendors could fix this instead of boost date-time having to fix it. Jeff

On Sat, 24 Jul 2004 11:24:39 +0100, John Maddock <john@johnmaddock.co.uk> wrote:
Just out of interest, what is the problem that prevents the date-time library from implementing a microsecond clock using GetSystemTimeAsFileTime on Win32?
Thanks,
John.
The resolution supplied by GetSystemTimeAsFileTime may not be what you think. I get 10 milliseconds resolution out of my machine from the following code. #include <Windows.h> #include <iostream> int main () { FILETIME ft1,ft2; GetSystemTimeAsFileTime( &ft1 ); GetSystemTimeAsFileTime( &ft2 ); std::size_t diff = ft2.dwLowDateTime - ft1.dwLowDateTime; while (diff == 0) { GetSystemTimeAsFileTime( &ft2 ); diff = ft2.dwLowDateTime - ft1.dwLowDateTime; } std::cout << "time taken = " << double(ft2.dwLowDateTime - ft1.dwLowDateTime) /10000 << "milliseconds\n"; system("pause"); return 0; } Regards, Matt Hurd.

On Mon, 26 Jul 2004 11:43:55 +1000, Matt Hurd wrote
On Sat, 24 Jul 2004 11:24:39 +0100, John Maddock <john@johnmaddock.co.uk> wrote:
Just out of interest, what is the problem that prevents the date-time library from implementing a microsecond clock using GetSystemTimeAsFileTime on Win32?
Thanks,
John.
The resolution supplied by GetSystemTimeAsFileTime may not be what you think. I get 10 milliseconds resolution out of my machine from the following code.
Yes, this is a problem -- but at least it is subsecond resolution which is better than the second level resolution of the other clock type. So 'high resolution clock' probably would be a better name with caveats by platform. BTW, part of the test is to ensure that the clock values monotonically increase with repeated sampling... Jeff

On Sat, 24 Jul 2004 11:24:39 +0100, John Maddock wrote
Just out of interest, what is the problem that prevents the date-time library from implementing a microsecond clock using GetSystemTimeAsFileTime on Win32?
We finally got this knocked off the todo list. If you look at the recent regression tests you will see the microsecond clock is now enabled and passing on a variety of Win32 compilers that were previously excluded. No guarantees that clocks on Win32 provide that level of resolution -- your resolution may be less, as we have discussed here. There is also a 'from_ftime' function (similar to from_time_t) to construct a ptime on Win32 -- which failed regressions last night because I failed to check in the entire change... Enjoy :-) Jeff

We finally got this knocked off the todo list. If you look at the recent regression tests you will see the microsecond clock is now enabled and passing on a variety of Win32 compilers that were previously excluded. No guarantees that clocks on Win32 provide that level of resolution -- your resolution may be less, as we have discussed here.
There is also a 'from_ftime' function (similar to from_time_t) to construct a ptime on Win32 -- which failed regressions last night because I failed to check in the entire change...
Enjoy :-)
Hey! Nice work, thanks, John.
participants (4)
-
Jeff Garland
-
John Maddock
-
Matt Hurd
-
Victor A. Wagner Jr.