Subject: [Boost-bugs] [Boost C++ Libraries] #8696: chrono compilation error on Solaris/gcc
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-06-14 10:55:57
#8696: chrono compilation error on Solaris/gcc
-------------------------------------+---------------------
Reporter: tmmikolajczyk@⦠| Owner: viboes
Type: Bugs | Status: new
Milestone: To Be Determined | Component: chrono
Version: Boost Development Trunk | Severity: Problem
Keywords: |
-------------------------------------+---------------------
The "timegm" function is not available on Solaris (Solaris 11) when using
the gcc toolchain. It works fine for the sunpro toolchain.
The "timegm" manual on regular linux says (man timegm):
"
For a portable version of timegm(), set the TZ environment variable
to UTC, call mktime(3) and restore
the value of TZ. Something like
#include <time.h>
#include <stdlib.h>
time_t
my_timegm(struct tm *tm)
{
time_t ret;
char *tz;
tz = getenv("TZ");
setenv("TZ", "", 1);
tzset();
ret = mktime(tm);
if (tz)
setenv("TZ", tz, 1);
else
unsetenv("TZ");
tzset();
return ret;
}
"
The Boost.Chrono has its own implementation available as the
internal_timegm() function, however the implementation is used only in
very limited cases (currently Windows but not Cygwin env.) selected by the
BOOST_CHRONO_INTERNAL_TIMEGM macrodefinition. The proposed patch enables
the internal_timegm() also for Solaris/gcc.
The issue concerns chrono in version 2 (BOOST_CHRONO_VERSION=2).
The attached application reproduces the issue:
$ g++ chrono_io_test_solaris.cpp -lboost_system -DBOOST_CHRONO_VERSION=2
In file included from boost/chrono/chrono_io.hpp:26:0,
from chrono_io_test_solaris.cpp:1:
boost/chrono/io/time_point_io.hpp: In function 'std::basic_istream<_CharT,
_Traits>& boost::chrono::operator>>(std::basic_istream<_CharT, _Traits>&,
boost::chrono::time_point<boost::chrono::system_clock, Duration>&)':
boost/chrono/io/time_point_io.hpp:1003:27: error: there are no arguments
to 'timegm' that depend on a template parameter, so a declaration of
'timegm' must be available
boost/chrono/io/time_point_io.hpp:1003:27: note: (if you use
'-fpermissive', G++ will accept your code, but allowing the use of an
undeclared name is deprecated)
boost/chrono/io/time_point_io.hpp:1055:29: error: there are no arguments
to 'timegm' that depend on a template parameter, so a declaration of
'timegm' must be available
$
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/8696> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:13 UTC