summaryrefslogtreecommitdiff
path: root/src/shutdown
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2019-05-06 01:28:07 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2019-05-06 01:28:07 +0000
commitb837b2ffeebf6af8f393f8e21405d0b7f265513b (patch)
tree28cd09218c105393fb638df3907fa7d0ddf82c15 /src/shutdown
parentbf3668cdf7327b2e02e734561e6daf9212da8924 (diff)
downloads6-linux-init-b837b2ffeebf6af8f393f8e21405d0b7f265513b.tar.xz
Fix shutdown time bug
Diffstat (limited to 'src/shutdown')
-rw-r--r--src/shutdown/s6-linux-init-shutdown.c8
1 files changed, 4 insertions, 4 deletions
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 ;
}