Skip to content

etl::clock refactored to use std::chrono. Fix an issue with animation playback in CMake builds - #1853

Merged
ice0 merged 2 commits into
synfig:masterfrom
ice0:fix-timer
Nov 26, 2020
Merged

ice0 merged 2 commits into
synfig:masterfrom
ice0:fix-timer

Conversation

@ice0

@ice0 ice0 commented Nov 16, 2020

Copy link
Copy Markdown
Collaborator
  • Removed unused ETL/clock headers
  • Moved from etl::clock to std::chrono. Fix an issue with animation playback in CMake builds.

@ice0
ice0 requested a review from rodolforg November 16, 2020 05:52
@ice0 ice0 linked an issue Nov 16, 2020 that may be closed by this pull request
@ice0 ice0 changed the title Moved from etl::clock to std::chrono. Fix an issue with animation playback in CMake builds. etl::clock refactored to use std::chrono. Fix an issue with animation playback in CMake builds Nov 17, 2020
@rodolforg

Copy link
Copy Markdown
Contributor

Is clock even used?

@ice0

ice0 commented Nov 19, 2020

Copy link
Copy Markdown
Collaborator Author

Is clock even used?

Yes, for animation synchronization, and for performance profiling (tests, etc)

@ice0
ice0 merged commit d3906ca into synfig:master Nov 26, 2020
@ice0
ice0 deleted the fix-timer branch November 26, 2020 05:42
@rodolforg rodolforg mentioned this pull request Apr 16, 2021
@akien-mga

akien-mga commented Jul 6, 2021 •

Copy link
Copy Markdown

For the reference, I'm running into an issue compiling Synfig 1.4.1 on Mageia 9 with GCC 11, which I think might be fixed by this PR. It doesn't seem to have been backported to the 1.4.x branch yet, may I suggest doing it for a potential future v1.4.2?

In file included from /usr/include/ETL/ETL/clock:56,
                 from target_tile.cpp:37:
/usr/include/ETL/ETL/_clock_system.h:34:27: error: using-declaration for non-member at class scope
   34 | #define __sys_clock     ::clock
      |                           ^~~~~
In file included from /usr/include/c++/11/mutex:39,
                 from node.h:40,
                 from valuenode.h:39,
                 from canvas.h:40,
                 from target.h:39,
                 from target_tile.h:32,
                 from target_tile.cpp:39:
/usr/include/c++/11/chrono:3341:25: error: expected ';' before '=' token
 3341 |       using __sys_clock = chrono::system_clock;
      |                         ^
/usr/include/c++/11/chrono:3341:25: error: expected unqualified-id before '=' token
/usr/include/c++/11/chrono:3353:63: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Clock, class _Dur> struct std::chrono::time_point'
 3353 |         _S_from_sys(const chrono::time_point<__sys_clock, _Dur>& __t) noexcept
      |                                                               ^
/usr/include/c++/11/chrono:3353:63: note:   expected a type, got 'clock'
/usr/include/c++/11/chrono:3362:45: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Clock, class _Dur> struct std::chrono::time_point'
 3362 |         chrono::time_point<__sys_clock, _Dur>
      |                                             ^
/usr/include/c++/11/chrono:3362:45: note:   expected a type, got 'clock'
/usr/include/c++/11/chrono: In static member function 'static std::filesystem::__file_clock::time_point std::filesystem::__file_clock::now()':
/usr/include/c++/11/chrono:3323:27: error: no matching function for call to 'std::filesystem::__file_clock::_S_from_sys(std::chrono::_V2::system_clock::time_point)'
 3323 |       { return _S_from_sys(chrono::system_clock::now()); }
      |                ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/chrono:3353:9: note: candidate: 'template<class _Dur> static std::chrono::time_point<std::filesystem::__file_clock, _Dur> std::filesystem::__file_clock::_S_from_sys(const int&)'
 3353 |         _S_from_sys(const chrono::time_point<__sys_clock, _Dur>& __t) noexcept
      |         ^~~~~~~~~~~
/usr/include/c++/11/chrono:3353:9: note:   template argument deduction/substitution failed:
/usr/include/c++/11/chrono:3323:27: note:   couldn't deduce template parameter '_Dur'
 3323 |       { return _S_from_sys(chrono::system_clock::now()); }
      |                ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/chrono: In static member function 'static std::chrono::time_point<std::filesystem::__file_clock, _Dur> std::filesystem::__file_clock::_S_from_sys(const int&)':
/usr/include/c++/11/chrono:3356:34: error: request for member 'time_since_epoch' in '__t', which is of non-class type 'const int'
 3356 |           return __file_time{__t.time_since_epoch()} - _S_epoch_diff;
      |                                  ^~~~~~~~~~~~~~~~
/usr/include/c++/11/chrono: In static member function 'static int std::filesystem::__file_clock::_S_to_sys(const std::chrono::time_point<std::filesystem::__file_clock, _Dur>&)':
/usr/include/c++/11/chrono:3365:28: error: expected ';' before '=' token
 3365 |           using __sys_time = chrono::time_point<__sys_clock, _Dur>;
      |                            ^
/usr/include/c++/11/chrono:3365:28: error: expected primary-expression before '=' token
/usr/include/c++/11/chrono:3365:66: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Clock, class _Dur> struct std::chrono::time_point'
 3365 |           using __sys_time = chrono::time_point<__sys_clock, _Dur>;
      |                                                                  ^
/usr/include/c++/11/chrono:3365:66: note:   expected a type, got 'clock'
/usr/include/c++/11/chrono:3366:28: error: expected ';' before '{' token
 3366 |           return __sys_time{__t.time_since_epoch()} + _S_epoch_diff;
      |                            ^
/usr/include/c++/11/chrono:3366:51: error: expected ';' before '}' token
 3366 |           return __sys_time{__t.time_since_epoch()} + _S_epoch_diff;
      |                                                   ^

@ice0

ice0 commented Jul 7, 2021

Copy link
Copy Markdown
Collaborator Author

may I suggest doing it for a potential future v1.4.2?

Sure. As a temporary solution, you can try to cherry-pick this commit or rename __sys_clock to something like synfig_sys_clock

rodolforg pushed a commit to rodolforg/synfig that referenced this pull request Jul 8, 2021
rodolforg pushed a commit to rodolforg/synfig that referenced this pull request Jul 8, 2021
rodolforg pushed a commit to rodolforg/synfig that referenced this pull request Jul 10, 2021
fix synfig-core tests after etl::clock change (based on synfig#2004)
morevnaproject pushed a commit that referenced this pull request Jul 12, 2021
fix synfig-core tests after etl::clock change (based on #2004)
morevnaproject pushed a commit to morevnaproject/synfig that referenced this pull request Aug 9, 2021
fix synfig-core tests after etl::clock change (based on synfig#2004)
morevnaproject pushed a commit to morevnaproject/synfig that referenced this pull request Aug 9, 2021
fix synfig-core tests after etl::clock change (based on synfig#2004)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CMake] Animation playback is not smooth anymore

4 participants