frontend: move time in a separate package to be used elsewhere

This commit is contained in:
nemunaire 2017-01-19 13:08:38 +01:00
parent 49933059f3
commit 51815862f7
3 changed files with 12 additions and 10 deletions

View file

@ -7,9 +7,9 @@ import (
"strconv"
"strings"
"time"
)
var challengeEnd time.Time = time.Unix(0, 0)
fronttime "srs.epita.fr/fic-server/frontend/time"
)
type SubmissionHandler struct {}
@ -36,7 +36,7 @@ func (s SubmissionHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
team := sURL[0]
if time.Now().Sub(challengeEnd) > 0 {
if time.Now().Sub(fronttime.ChallengeEnd) > 0 {
http.Error(w, "{\"errmsg\":\"Vous ne pouvez plus soumettre, le challenge est terminé.\"}", http.StatusForbidden)
return
}