From c8a30592e81b5ae15a35a0e9f52c395fa75ca752 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 7 Jan 2018 17:23:51 -0800 Subject: Only print the time in alffplay when it changes --- examples/alffplay.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'examples/alffplay.cpp') diff --git a/examples/alffplay.cpp b/examples/alffplay.cpp index 42987b86..acd2e149 100644 --- a/examples/alffplay.cpp +++ b/examples/alffplay.cpp @@ -1467,7 +1467,7 @@ int MovieState::parse_handler() // Helper class+method to print the time with human-readable formatting. struct PrettyTime { - seconds_d64 mTime; + seconds mTime; }; inline std::ostream &operator<<(std::ostream &os, const PrettyTime &rhs) { @@ -1475,7 +1475,7 @@ inline std::ostream &operator<<(std::ostream &os, const PrettyTime &rhs) using minutes = std::chrono::minutes; using std::chrono::duration_cast; - seconds t = duration_cast(rhs.mTime); + seconds t = rhs.mTime; if(t.count() < 0) { os << '-'; @@ -1636,13 +1636,19 @@ int main(int argc, char *argv[]) enum class EomAction { Next, Quit } eom_action = EomAction::Next; + seconds last_time(-1); SDL_Event event; while(1) { int have_evt = SDL_WaitEventTimeout(&event, 10); - std::cout<< "\r "<getMasterClock()}<<" / "<< - PrettyTime{movState->getDuration()} <(movState->getMasterClock()); + if(cur_time != last_time) + { + auto end_time = std::chrono::duration_cast(movState->getDuration()); + std::cout<< "\r "<