Getting the current date from the clock

I'm doing it

 boost::gregorian::date current_date(boost::date_time::day_clock::local_day());

and I get the following error:

template<class date_type> class boost::date_time::day_clock’ used without template parameters  

Anything I need to do for others?

link http://www.boost.org/doc/libs/1_47_0/doc/html/date_time/gregorian.html#date_construct_from_clock

+3
source share
2 answers

You are using the wrong one day_clock- use instead:

boost::gregorian::date current_date(boost::gregorian::day_clock::local_day());

day_clockc boost::date_timeis a common interface (a template in this case) intended for use with an external date type, and you do not supply this type. day_clockin boost::gregorianis the typedef of the specified interface, using the boost::gregorian::datedate type as the supplied type.

+11
source

All Articles