diff --git a/changes.yaml b/changes.yaml index 4150a3509..0f2e5dcfc 100644 --- a/changes.yaml +++ b/changes.yaml @@ -1,7 +1,14 @@ --- releases: + - version: 1.11.0-beta.13 + date: 2024-05-12T17:11:00+02:00 + short: |- + Workrave 1.11.0-beta.13 has been released. + changes: + - Fix hibernate/suspend (#539, #540) + - version: 1.11.0-beta.12 - date: 22024-03-21T19:48:51+01:00 + date: 2024-03-21T19:48:51+01:00 short: |- Workrave 1.11.0-beta.12 has been released. changes: diff --git a/libs/core/src/Core.cc b/libs/core/src/Core.cc index 44189dd39..11c7addda 100644 --- a/libs/core/src/Core.cc +++ b/libs/core/src/Core.cc @@ -1093,6 +1093,15 @@ Core::process_timewarp() { TRACE_MSG("Time warp of {} seconds because of powersave", gap); + force_idle(); + + TimeSource::set_real_time_sec_sync(last_process_time + 1); + monitor_state = ACTIVITY_IDLE; + + process_timers(); + + TimeSource::sync(); + // In case the windows message was lost. some people reported that // workrave never restarted the timers... remove_operation_mode_override("powersave"); @@ -1126,19 +1135,31 @@ Core::process_timewarp() if (gap >= 30) { - TRACE_MSG("Time warp of {} seconds. Powersae", gap); + TRACE_MSG("Time warp of {} seconds. Powersave", gap); + spdlog::info("Time warp of {} seconds. Powersave", gap); + TRACE_MSG("current time {}", current_time); + TRACE_MSG("synced time {}", TimeSource::get_real_time_sec_sync()); + TRACE_MSG("last process time {}", last_process_time); force_idle(); - int64_t save_current_time = current_time; - - current_time = last_process_time + 1; + TimeSource::set_real_time_sec_sync(last_process_time + 1); monitor_state = ACTIVITY_IDLE; process_timers(); - current_time = save_current_time; + TimeSource::sync(); ret = true; + + remove_operation_mode_override("powersave"); + } + + if (powersave && powersave_resume_time != 0 && current_time > powersave_resume_time + 30) + { + TRACE_MSG("End of time warp after powersave"); + + powersave = false; + powersave_resume_time = 0; } } diff --git a/libs/core/src/Timer.cc b/libs/core/src/Timer.cc index 7ca6754f0..0026e3280 100644 --- a/libs/core/src/Timer.cc +++ b/libs/core/src/Timer.cc @@ -574,7 +574,7 @@ Timer::get_elapsed_idle_time() const int64_t Timer::get_elapsed_time() const { - TRACE_ENTRY(); + TRACE_ENTRY_PAR(timer_id, timer_state); int64_t ret = elapsed_time; TRACE_VAR(ret, TimeSource::get_real_time_sec_sync(), last_start_time); diff --git a/libs/utils/include/utils/TimeSource.hh b/libs/utils/include/utils/TimeSource.hh index 4a5d63478..0890152e9 100644 --- a/libs/utils/include/utils/TimeSource.hh +++ b/libs/utils/include/utils/TimeSource.hh @@ -48,6 +48,9 @@ namespace workrave::utils //! Returns the system wall-clock time synchronized with core in seconds. static int64_t get_real_time_sec_sync(); + //! Sets the system wall-clock time synchronized with core in seconds. + static void set_real_time_sec_sync(int64_t t); + //! Returns the system monotonic time synchronized with core in seconds, if available. static int64_t get_monotonic_time_sec_sync(); diff --git a/libs/utils/src/TimeSource.cc b/libs/utils/src/TimeSource.cc index e155b5af1..65fee47e3 100644 --- a/libs/utils/src/TimeSource.cc +++ b/libs/utils/src/TimeSource.cc @@ -82,6 +82,12 @@ TimeSource::get_real_time_sec_sync() return synced_real_time / TIME_USEC_PER_SEC; } +void +TimeSource::set_real_time_sec_sync(int64_t t) +{ + synced_real_time = t * TIME_USEC_PER_SEC; +} + int64_t TimeSource::get_monotonic_time_sec_sync() {