mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-03 08:28:31 +00:00
Start of statsweb program
This commit is contained in:
parent
56b86ad4e3
commit
9fc946e373
7 changed files with 130 additions and 10 deletions
|
@ -1,3 +1,40 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"flag"
|
||||
"github.com/clarkduvall/hyperloglog"
|
||||
"time"
|
||||
"bitbucket.org/stendec/frankerfacez/socketserver/server"
|
||||
)
|
||||
|
||||
var configLocation = flag.String("config", "./config.json", "Location of the configuration file. Defaults to ./config.json")
|
||||
var genConfig = flag.Bool("genconf", false, "Generate a new configuration file.")
|
||||
|
||||
var config ConfigFile
|
||||
|
||||
const ExitCodeBadConfig = 2
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
if *genConfig {
|
||||
makeConfig()
|
||||
return
|
||||
}
|
||||
|
||||
loadConfig()
|
||||
|
||||
http.ListenAndServe(config.ListenAddr, http.DefaultServeMux)
|
||||
}
|
||||
|
||||
func combineDateRange(from time.Time, to time.Time, dest *hyperloglog.HyperLogLogPlus) error {
|
||||
from = server.TruncateToMidnight(from)
|
||||
to = server.TruncateToMidnight(to)
|
||||
year, month, day := from.Date()
|
||||
for current := from; current.Before(to); day = day + 1 {
|
||||
current = time.Date(year, month, day, 0, 0, 0, 0, server.CounterLocation)
|
||||
|
||||
}
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue