better migrator and page timing

This commit is contained in:
ston1th 2019-08-24 18:33:13 +02:00
commit 9ecaf33d86
4 changed files with 19 additions and 12 deletions

View file

@ -11,6 +11,7 @@ import (
"html/template"
"net/http"
"net/url"
"strconv"
"time"
)
@ -60,7 +61,7 @@ type Context struct {
type webData struct {
Version string
Time int64
Time string
Title string
BodyTitle string
@ -112,7 +113,12 @@ func (c *Context) Exec() {
c.Data.Admin = c.Admin()
c.Data.User = c.User()
c.Data.Login = c.LoggedOn()
c.Data.Time = time.Since(c.Time).Nanoseconds() / 1e6
t := strconv.Itoa(int(time.Since(c.Time).Nanoseconds()/1e6)) + "ms"
if t == "0ms" {
t = strconv.Itoa(int(time.Since(c.Time).Nanoseconds()/1e5)) + "µs"
}
c.Data.Time = t
if c.Data.Msg != "" {
c.Status = http.StatusBadRequest