Opened 12 years ago

Last modified 11 years ago

#4856 new Bugs

compilation error: boost::local_time::local_microsec_clock::local_time()

Reported by: dobrov0@… Owned by: az_sw_dude
Milestone: To Be Determined Component: date_time
Version: Boost 1.42.0 Severity: Problem
Keywords: local_time Cc: manish.mulimani@…

Description

just simple call: boost::local_time::local_microsec_clock::local_time()

produces compilation error:

/usr/include/boost/date_time/microsec_time_clock.hpp:116:

error: no matching function for call to

'boost::local_time::local_date_time_base<boost::posix_time::ptime, boost::date_time::time_zone_base<boost::posix_time::ptime, char>

::local_date_time_base(boost::gregorian::date&, boost::posix_time::time_duration&)'


platform ubuntu linux 10.10 x64 compiler: gcc 4.4.5 boost ver: 1.42

I have information from other party that the same problem occurs under MS Windows, with visual studio and boost 1.44

Change History (3)

comment:1 by Katie Chan, 12 years ago

Yes, this is a problem with Visual Studio as well.

Note that the same bug occur when calling:

boost::local_time::local_sec_clock::local_time();
1>------ Build started: Project: test, Configuration: Debug Win32 ------
1>Build started 30/11/2010 12:59:54.
1>InitializeBuildStatus:
1>  Touching "Debug\test.unsuccessfulbuild".
1>ClCompile:
1>  test.cpp
1>d:\libs\boost_1_45_0\boost\date_time\microsec_time_clock.hpp(116): error C2665: 'boost::local_time::local_date_time_base<>::local_date_time_base' : none of the 5 overloads could convert all the argument types
1>          d:\libs\boost_1_45_0\boost\date_time\local_time\local_date_time.hpp(81): could be 'boost::local_time::local_date_time_base<>::local_date_time_base(boost::posix_time::ptime,boost::shared_ptr<T>)'
1>          with
1>          [
1>              T=boost::date_time::time_zone_base<boost::posix_time::ptime,char>
1>          ]
1>          d:\libs\boost_1_45_0\boost\date_time\local_time\local_date_time.hpp(220): or       'boost::local_time::local_date_time_base<>::local_date_time_base(const boost::date_time::special_values,boost::shared_ptr<T>)'
1>          with
1>          [
1>              T=boost::date_time::time_zone_base<boost::posix_time::ptime,char>
1>          ]
1>          while trying to match the argument list '(boost::gregorian::date, boost::posix_time::time_duration)'
1>          d:\libs\boost_1_45_0\boost\date_time\microsec_time_clock.hpp(81) : while compiling class template member function 'boost::local_time::local_date_time boost::date_time::microsec_clock<time_type>::create_time(boost::date_time::microsec_clock<time_type>::time_converter)'
1>          with
1>          [
1>              time_type=boost::local_time::local_date_time
1>          ]
1>          l:\users\ktc\documents\visual studio 2010\projects\date_time\test\test.cpp(30) : see reference to class template instantiation 'boost::date_time::microsec_clock<time_type>' being compiled
1>          with
1>          [
1>              time_type=boost::local_time::local_date_time
1>          ]
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:06.66
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

comment:2 by Manish Mulimani <manish.mulimani@…>, 11 years ago

It works with posix time:

#include <boost/date_time/posix_time/ptime.hpp>

#include <boost/date_time/microsec_time_clock.hpp>

#include <boost/date_time/local_time/local_time.hpp>

int main(int argc, char *argv[]) {

std::cout << boost::date_time::microsec_clock<boost::posix_time::ptime>::local_time() << std::endl; return 0;

}

However as reported in bug, it does not work with local time. There is no overloaded constructor of boost::local_time::local_date_time_base, with following prototype: local_date_time_base(date_type,time_duration_type).

There are 3 parameterized constructors defined: i> local_date_time_base(utc_time_type, boost::shared_ptr<tz_type>) ii> local_date_time_base(date_type, time_duration_type, boost::shared_ptr<tz_type>, bool) iii> local_date_time_base(date_type, time_duration_type, boost::shared_ptr<tz_type>, DST_CALC_OPTIONS)

comment:3 by Manish Mulimani <manish.mulimani@…>, 11 years ago

Cc: manish.mulimani@… added
Note: See TracTickets for help on using tickets.