more development

This commit is contained in:
2021-12-09 16:28:45 -06:00
parent 8d8f68957f
commit 4278e622ce
4 changed files with 91 additions and 10 deletions

View File

@@ -1,7 +1,11 @@
package main
import (
"fmt"
"log"
"math"
"os"
"time"
)
func main() {
@@ -11,4 +15,20 @@ func main() {
if err != nil {
log.Fatalf("[ERROR] Unable to calculate sunrise/sunset: %v\n", err)
}
if config.NextSunrise || config.NextSunset {
sR, sS, err := nextSunriseSunsetTime(config.SunRiseSet.Date)
if err != nil {
runError(fmt.Sprintf("Unable to calculate sunrise/sunset: %v\n", err))
}
switch {
case config.NextSunrise:
fmt.Printf("%v\n", math.Round(sR.Sub(time.Now()).Seconds()))
case config.NextSunset:
fmt.Printf("%v\n", math.Round(sS.Sub(time.Now()).Seconds()))
}
os.Exit(0)
}
}