sleep: fix default values unmatched with manual

This commit is contained in:
Mike Yuan
2023-03-18 02:28:22 +08:00
parent 212272f32b
commit f05b4bb9a7
2 changed files with 5 additions and 2 deletions
+1 -1
View File
@@ -197,7 +197,7 @@
capacity level and estimate battery discharging rate, which is used for estimating timespan until the system battery charge
level goes down to 5%. Only used by
<citerefentry><refentrytitle>systemd-suspend-then-hibernate.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
Defaults to 2h.</para></listitem>
Defaults to 1h.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
+4 -1
View File
@@ -39,6 +39,8 @@
#include "strv.h"
#include "time-util.h"
#define DEFAULT_HIBERNATE_DELAY_USEC_NO_BATTERY (2 * USEC_PER_HOUR)
static SleepOperation arg_operation = _SLEEP_OPERATION_INVALID;
static int write_hibernate_location_info(const HibernateLocation *hibernate_location) {
@@ -292,7 +294,8 @@ static int custom_timer_suspend(const SleepConfig *sleep_config) {
if (hashmap_isempty(last_capacity))
/* In case of no battery, system suspend interval will be set to HibernateDelaySec= or 2 hours. */
suspend_interval = timestamp_is_set(hibernate_timestamp) ? sleep_config->hibernate_delay_usec : DEFAULT_SUSPEND_ESTIMATION_USEC;
suspend_interval = timestamp_is_set(hibernate_timestamp)
? sleep_config->hibernate_delay_usec : DEFAULT_HIBERNATE_DELAY_USEC_NO_BATTERY;
else {
r = get_total_suspend_interval(last_capacity, &suspend_interval);
if (r < 0) {