Boost logo

Boost Users :

Subject: [Boost-users] [Date_Time] Visual Studio 8 debugger visualizer
From: Bruno Durin (bruno.durin_at_[hidden])
Date: 2010-04-07 17:54:22


Hi,

This is my second post in a mailing list and my first on boost-users
so I apologize for the naive style and for my English (I am not a
native English speaker).
I would like to give a solution to a problem that kept annoying me for
a long time
when debugging code using Boost.Date_Time in Visual Studio 8.
The library is based on an int representation of datetime and this int
is displayed
by the debugger, which gets hard to understand if it's the correct
datetime or not.
The solution, as already explained in
http://www.virtualdub.org/blog/pivot/entry.php?id=120,
is to customize Visual Studio debugger.
I have found a solution in boost documentation section, provided by
filip dot konvicka at logis dot cz, but you have to click refresh to
get the info displayed.
I thus suggest a partial brute force solution for boost::gregorian::date,
boost::posix_time::time_duration and boost::posix_time::ptime (the
only objects I use,
but extension to local time zone should be easy).
This solution simply recodes the conversion functions available in
Boost.Date_Time,
adding some formatting. I included it as an attachement because of the
length of some lines
is very long.
As an example
    boost::posix_time::ptime a_time(boost::gregorian::date(2010, Apr,
7), boost::posix_time::hours(22))
would display instantaneously in the preview area in the debugger as
    a_time 2010-4-7 22h0m0s (0us)
Note: us is microseconds. If you work with nanosecond resolution, you
have to change the visualizer definition.
In order to get it work, backup the file autoexp.dat (it's in the
installation directory of Visual Studio),
and add the content of the attachement in the [Visualizer] section. It
should work without even
restarting Visual Studio. I have only tested under Visual Studio 8
2005, but it should work as well
with Visual Studio 9 2008.
Hope that will help!

Bruno Durin.




Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net