WaitForClock: give up after 1 year, not 1 minute

related to issue #21
This commit is contained in:
Michael Stapelberg 2017-03-25 20:47:47 +01:00
parent 83181ca00c
commit 3999a60a05

View File

@ -138,12 +138,12 @@ func Supervise(commands []*exec.Cmd) error {
// set. Assumes that the system boots with a clock value of January 1, // set. Assumes that the system boots with a clock value of January 1,
// 1970 UTC (UNIX epoch), as is the case on the Raspberry Pi 3. // 1970 UTC (UNIX epoch), as is the case on the Raspberry Pi 3.
func WaitForClock() { func WaitForClock() {
epochPlus1Minute := time.Unix(60, 0) epochPlus1Year := time.Unix(60*60*24*365, 0)
for { for {
if time.Now().After(epochPlus1Minute) { if time.Now().After(epochPlus1Year) {
return return
} }
// Sleeps for 1 real minute, regardless of wall-clock time. // Sleeps for 1 real second, regardless of wall-clock time.
// See https://github.com/golang/proposal/blob/master/design/12914-monotonic.md // See https://github.com/golang/proposal/blob/master/design/12914-monotonic.md
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)
} }