Modify

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#8696 closed Bugs (fixed)

chrono compilation error on Solaris/gcc

Reported by: tmmikolajczyk@… Owned by: viboes
Milestone: Boost 1.54.0 Component: chrono
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

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 $

Attachments (2)

bug_8696.patch (652 bytes) - added by tmmikolajczyk@… 4 years ago.
patch
chrono_io_test_solaris.cpp (156 bytes) - added by tmmikolajczyk@… 4 years ago.
application to reproduce the issue

Download all attachments as: .zip

Change History (6)

Changed 4 years ago by tmmikolajczyk@…

Attachment: bug_8696.patch added

patch

Changed 4 years ago by tmmikolajczyk@…

Attachment: chrono_io_test_solaris.cpp added

application to reproduce the issue

comment:1 Changed 4 years ago by viboes

Milestone: To Be DeterminedBoost 1.54.0
Status: newassigned

Thanks for the patch.

comment:2 Changed 4 years ago by viboes

Committed revision [84790].

comment:3 Changed 4 years ago by viboes

Resolution: fixed
Status: assignedclosed

(In [84793]) Chrono: fix #8691,#8696 and update history.

comment:4 Changed 4 years ago by Stephen Clamage <stephen.clamage@…>

The original ticket description claims that timegm is available when using the sunpro toolchain on Solaris 11. That claim is not correct, and even with this bug fix the code does not work with the sunpro toolchain. I filed new ticket 9918 for this problem.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain viboes.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.