SimpleCloudNotifier/scnserver/util.go

25 lines
499 B
Go
Raw Normal View History

package server
import (
"gogs.mikescher.com/BlackForestBytes/goext/timeext"
2023-01-15 06:30:30 +01:00
"math/rand"
"time"
)
func QuotaDayString() string {
return time.Now().In(timeext.TimezoneBerlin).Format("2006-01-02")
}
2022-11-20 15:40:19 +01:00
func NextDeliveryTimestamp(now time.Time) time.Time {
return now.Add(5 * time.Second)
}
2023-01-15 06:30:30 +01:00
func RandomAuthKey() string {
charset := "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
k := ""
for i := 0; i < 64; i++ {
k += string(charset[rand.Int()%len(charset)])
}
return k
}