]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sleep: rename hibernate_delay_sec -> _usec
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 13 Nov 2022 14:59:49 +0000 (23:59 +0900)
committerLuca Boccassi <bluca@debian.org>
Thu, 26 Jan 2023 11:22:04 +0000 (11:22 +0000)
src/shared/sleep-config.c
src/shared/sleep-config.h
src/sleep/sleep.c

index caf94b455cbed208cb27acb7c7dc537ca2e38a1e..260e8ccca48d6b1e91e4dc924f0ad255c6d3ba47 100644 (file)
@@ -82,7 +82,7 @@ int parse_sleep_config(SleepConfig **ret_sleep_config) {
                 { "Sleep", "HybridSleepMode",           config_parse_strv,     0, sc->modes + SLEEP_HYBRID_SLEEP  },
                 { "Sleep", "HybridSleepState",          config_parse_strv,     0, sc->states + SLEEP_HYBRID_SLEEP },
 
-                { "Sleep", "HibernateDelaySec",         config_parse_sec,      0, &sc->hibernate_delay_sec        },
+                { "Sleep", "HibernateDelaySec",         config_parse_sec,      0, &sc->hibernate_delay_usec       },
                 {}
         };
 
@@ -113,8 +113,8 @@ int parse_sleep_config(SleepConfig **ret_sleep_config) {
                 sc->modes[SLEEP_HYBRID_SLEEP] = strv_new("suspend", "platform", "shutdown");
         if (!sc->states[SLEEP_HYBRID_SLEEP])
                 sc->states[SLEEP_HYBRID_SLEEP] = strv_new("disk");
-        if (sc->hibernate_delay_sec == 0)
-                sc->hibernate_delay_sec = 2 * USEC_PER_HOUR;
+        if (sc->hibernate_delay_usec == 0)
+                sc->hibernate_delay_usec = 2 * USEC_PER_HOUR;
 
         /* Ensure values set for all required fields */
         if (!sc->states[SLEEP_SUSPEND] || !sc->modes[SLEEP_HIBERNATE]
index af6947d98288ef80c780757b25127bf77c422a82..813f33c7c0662edc5a89a1c83ca1b9ee192c4a4a 100644 (file)
@@ -19,7 +19,7 @@ typedef struct SleepConfig {
         bool allow[_SLEEP_OPERATION_MAX];
         char **modes[_SLEEP_OPERATION_MAX];
         char **states[_SLEEP_OPERATION_MAX];
-        usec_t hibernate_delay_sec;
+        usec_t hibernate_delay_usec;
 } SleepConfig;
 
 SleepConfig* free_sleep_config(SleepConfig *sc);
index c2c8c779ad8bea209531608363fdfea8dafb8573..37d434bef35e8cca47d50f8500735651143ca0a2 100644 (file)
@@ -275,7 +275,7 @@ static int custom_timer_suspend(const SleepConfig *sleep_config) {
                 _cleanup_hashmap_free_ Hashmap *last_capacity = NULL, *current_capacity = NULL;
                 _cleanup_close_ int tfd = -EBADF;
                 struct itimerspec ts = {};
-                usec_t suspend_interval = sleep_config->hibernate_delay_sec, before_timestamp = 0, after_timestamp = 0, total_suspend_interval;
+                usec_t suspend_interval = sleep_config->hibernate_delay_usec, before_timestamp = 0, after_timestamp = 0, total_suspend_interval;
                 bool woken_by_timer;
 
                 tfd = timerfd_create(CLOCK_BOOTTIME_ALARM, TFD_NONBLOCK|TFD_CLOEXEC);