Boost logo

Boost Users :

From: Sean Rohead (sean.rohead_at_[hidden])
Date: 2005-07-22 19:15:27


Thank you!

I also discovered that this works:

time_duration t(8, 45, 0, milliseconds(100).fractional_seconds());

Sean

-----Original Message-----
From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of Jeff Garland
Sent: Thursday, July 21, 2005 9:37 PM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] Can't create time_duration with milliseconds
onVS.NET 2003

On Thu, 21 Jul 2005 18:37:32 -0600, Sean Rohead wrote
> I am using VS.NET 2003 and attempting to create a time_duration
> using hours, minutes, seconds, and milliseconds.
>
> However, I get an error message regarding the 4th parameter
> (milliseconds).
>
> Here is my code and the error message:
>
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> // main.cpp
>
> #include "boost/date_time/posix_time/posix_time.hpp"
>
> using namespace boost::posix_time;
>
> void main()
> {
> time_duration t(8, 45, 00, milliseconds(100));
> }

The error is valid. Milliseconds is-a time-duration so you don't pass
it as
the fourth parameter. Add it instead. Something like:

Try this instead:
   time_duration t(8, 45,0);
   t += milliseconds(100);

or even clearer:

   time_duration t = hours(8) + minutes(45) + milliseconds(100);

Jeff
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


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