fehlerbehebung

This commit is contained in:
xoy 2023-01-28 22:22:13 +01:00
parent 6bef9dbd07
commit 417ca571de
2 changed files with 15 additions and 5 deletions

View File

@ -9,8 +9,8 @@ import (
) )
func logger(input string) { func logger(input string) {
println("[" + time.Now().Format("15:04:05 CET") + "] " + input) println("[" + time.Now().Format("15:04:05") + "] " + input)
fileAddLine("["+time.Now().Format("15:04:05 CET")+"] "+input, "./log/"+time.Now().Format("2006-02-01 CET")+".log") fileAddLine("["+time.Now().Format("15:04:05")+"] "+input, "./log/"+time.Now().Format("2006-02-01")+".log")
} }
func handler() { func handler() {
@ -212,7 +212,7 @@ func getNextTopic() topic {
var output topic var output topic
for i := 0; i < 31; i++ { for i := 0; i < 31; i++ {
newDate := stringSplit(date.AddDate(0, 0, 1*i).Format("Mon Jan _2 15:04:05 CET 2006"), " ") newDate := stringSplit(date.AddDate(0, 0, 1*i).Format(time.UnixDate), " ")
if newDate[0] == "Thu" || newDate[0] == "Tue" { if newDate[0] == "Thu" || newDate[0] == "Tue" {
dayA, errA := strconv.Atoi(newDate[2]) dayA, errA := strconv.Atoi(newDate[2])
@ -222,7 +222,7 @@ func getNextTopic() topic {
errorPanic(errB) errorPanic(errB)
if ifFloatRange(float64(dayA)/7, 0, 1, false, true) || (ifFloatRange(float64(dayB)/7, 2, 3, false, true) && newDate[0] == "Tue") { if ifFloatRange(float64(dayA)/7, 0, 1, false, true) || (ifFloatRange(float64(dayB)/7, 2, 3, false, true) && newDate[0] == "Tue") {
output.date = date.AddDate(0, 0, 1*i).Format("02.01.2006 CET") output.date = date.AddDate(0, 0, 1*i).Format("02.01.2006")
output.days = i output.days = i
break break
} }

12
main.go
View File

@ -4,13 +4,23 @@ import (
"net/http" "net/http"
) )
/*
Timezone = UTC
*/
func main() { func main() {
addr := readHttpYML() addr := readHttpYML()
logger("Connection open with address " + addr) logger("----------------START----------------")
logger("timezone = UTC")
logger("connection open with address " + addr)
handler() handler()
err := http.ListenAndServe(addr, nil) err := http.ListenAndServe(addr, nil)
errorPanic(err) errorPanic(err)
defer logger("----------------END----------------")
} }