Boost logo

Boost Users :

From: Ken Klose (ken.klose_at_[hidden])
Date: 2007-05-15 19:43:54


Beth,

Thanks. I also found I can accomplish this using the + operator:

time_period(second_clock::local_time, second_clock::local_time + years(1));

Thanks,
Ken

"Beth Jacobson" <bethj_at_[hidden]> wrote in message
news:f2d77a$4gh$1_at_sea.gmane.org...
> Ken Klose wrote:
>> I'm want to represent a period of time of 1 year starting at the current
>> ptime and ending at the corresponding ptime a year from now.
>>
>> I've tried this:
>> boost::posix_time::time_period _time_period(
>> boost::posix_time::second_clock::local_time(),
>> boost::gregorian::years(1)
>> );
>>
>> However I get this error:
>> error: no matching function for call to
>> `boost::date_time::period<boost::posix_time::ptime,
>> boost::posix_time::time_duration>::period(boost::posix_time::ptime,
>> boost::gregorian::years)'
>>
>> Any thoughts on how to solve my problem?
>>
>> Thanks,
>> Ken
>
> Time_period can't be initialized with a date_duration. Try replacing
> boost::gregorian::years(1) with boost::posix_time::hours(24*365).
>
> HTH,
> Beth


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