From b837b2ffeebf6af8f393f8e21405d0b7f265513b Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 6 May 2019 01:28:07 +0000 Subject: Fix shutdown time bug --- src/shutdown/s6-linux-init-shutdown.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/shutdown/s6-linux-init-shutdown.c b/src/shutdown/s6-linux-init-shutdown.c index 3e791f1..2779537 100644 --- a/src/shutdown/s6-linux-init-shutdown.c +++ b/src/shutdown/s6-linux-init-shutdown.c @@ -52,7 +52,7 @@ static inline void add_one_day (struct tm *tm) static inline void parse_hourmin (tain_t *when, char const *s) { tai_t taithen ; - struct tm tmnow, tmthen ; + struct tm tmthen ; unsigned int hour, minute ; size_t len = uint_scan(s, &hour) ; if (!len || len > 2 || s[len] != ':' || hour > 23) @@ -61,11 +61,11 @@ static inline void parse_hourmin (tain_t *when, char const *s) len = uint0_scan(s, &minute) ; if (!len || len != 2 || minute > 59) strerr_dief1x(100, "invalid time format") ; - if (!localtm_from_tai(&tmnow, tain_secp(&STAMP), 1)) + if (!localtm_from_tai(&tmthen, tain_secp(&STAMP), 1)) strerr_diefu1sys(111, "break down current time into struct tm") ; - tmthen = tmnow ; tmthen.tm_hour = hour ; tmthen.tm_min = minute ; + tmthen.tm_sec = 0 ; if (!tai_from_localtm(&taithen, &tmthen)) strerr_diefu1sys(111, "assemble broken-down time into tain_t") ; if (tai_less(&taithen, tain_secp(&STAMP))) @@ -74,7 +74,7 @@ static inline void parse_hourmin (tain_t *when, char const *s) if (!tai_from_localtm(&taithen, &tmthen)) strerr_diefu1sys(111, "assemble broken-down time into tain_t") ; } - tai_sub(tain_secp(when), &taithen, tain_secp(&STAMP)) ; + when->sec = taithen ; when->nano = 0 ; } -- cgit v1.2.3