1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-08-23 06:20:54 +00:00

lmao time.UnixDate sounds like a great idea doesn't it

This commit is contained in:
Kane York 2016-01-03 08:57:37 -08:00
parent b22efabfed
commit 1a709d6e51
3 changed files with 17 additions and 10 deletions

View file

@ -241,11 +241,13 @@ func HTTPBackendCachedPublish(w http.ResponseWriter, r *http.Request) {
channel := formData.Get("channel")
deleteMode := formData.Get("delete") != ""
timeStr := formData.Get("time")
timestamp, err := time.Parse(time.UnixDate, timeStr)
timeNum, err := strconv.ParseInt(timeStr, 10, 64)
if err != nil {
w.WriteHeader(422)
fmt.Fprintf(w, "error parsing time: %v", err)
return
}
timestamp := time.Unix(timeNum, 0)
cacheinfo, ok := S2CCommandsCacheInfo[cmd]
if !ok {

View file

@ -6,9 +6,9 @@ import (
"encoding/binary"
"encoding/gob"
"fmt"
"net/http"
"io/ioutil"
"log"
"net/http"
"os"
"time"
@ -160,6 +160,7 @@ func writeAllHLLs() error {
}
var hllFileServer = http.StripPrefix("/hll", http.FileServer(http.Dir(uniqCountDir)))
func HTTPShowHLL(w http.ResponseWriter, r *http.Request) {
hllFileServer.ServeHTTP(w, r)
}
@ -239,7 +240,9 @@ func getNextMidnight() time.Time {
// is_init_func
func rolloverCounters() {
for {
time.Sleep(getNextMidnight().Sub(time.Now()))
duration := getNextMidnight().Sub(time.Now())
// fmt.Println(duration)
time.Sleep(duration)
rolloverCounters_do()
}
}