boost::timer deprecation and compile failure

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderators: Committer, Committer

Post Reply
Message
Author
raptor
Space Squid
Posts: 80
Joined: Sat Jun 02, 2012 11:29 pm

boost::timer deprecation and compile failure

#1 Post by raptor » Tue Feb 04, 2020 12:07 am

Hi,

I've been attempting to build the 0.4.9 RC3 with openSUSE Tumbleweed and the deprecation warnings for boost::timer are finally showing up as compile errors. I did a code search and found the locations of the usage:

Code: Select all

./python/AI/AIFramework.cpp:142:    boost::timer order_timer;
./UI/TechTreeWnd.cpp:1845:    boost::timer insertion_timer;
./UI/TechTreeWnd.cpp:1903:    boost::timer creation_timer;
./universe/Universe.cpp:1213:    boost::timer type_timer;
./universe/Universe.cpp:1214:    boost::timer eval_timer;
./network/Message.cpp:824:                boost::timer deserialize_timer;
./network/Message.cpp:869:            boost::timer deserialize_timer;
Can these be replaced?

This distro is using Boost 1.71. Additionally, there are many places that include `boost/timer.hpp` which should be `boost/timer/timer.hpp` instead. I've started a patch (attached), but I am unsure of how to actually do the timer replacement in the code.
freeorion-boost_timer_header.patch.zip
(1.26 KiB) Downloaded 1 time

raptor
Space Squid
Posts: 80
Joined: Sat Jun 02, 2012 11:29 pm

Re: boost::timer deprecation and compile failure

#2 Post by raptor » Tue Feb 04, 2020 3:58 pm

I just found out I can compile with 'BOOST_ALLOW_DEPRECATED_HEADERS'. I'll attempt that for now.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12528
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: boost::timer deprecation and compile failure

#3 Post by Geoff the Medio » Tue Feb 04, 2020 5:02 pm

I looked at this earlier this morning. The replacement for boost::timer isn't drop-in and makes it surprisingly hard to just get an elapsed time in seconds. It should be fixable with cpu_timer but not trivially.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12528
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: boost::timer deprecation and compile failure

#4 Post by Geoff the Medio » Tue Feb 04, 2020 11:55 pm


raptor
Space Squid
Posts: 80
Joined: Sat Jun 02, 2012 11:29 pm

Re: boost::timer deprecation and compile failure

#5 Post by raptor » Tue Feb 11, 2020 5:09 pm

Thanks!

Will this be included in the python3 release?

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12528
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: boost::timer deprecation and compile failure

#6 Post by Geoff the Medio » Tue Feb 11, 2020 5:36 pm

It's already in master, so yes, unless something weird happens.

Post Reply