admin: display on interface time synchronization diff
This commit is contained in:
parent
fa33fac003
commit
5dcb13629a
5 changed files with 48 additions and 1 deletions
26
admin/api/timestamp.go
Normal file
26
admin/api/timestamp.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/julienschmidt/httprouter"
|
||||
)
|
||||
|
||||
var TimestampCheck = "submissions"
|
||||
|
||||
func init() {
|
||||
router.GET("/api/timestamps.json", apiHandler(
|
||||
func(httprouter.Params, []byte) (interface{}, error) {
|
||||
if stat, err := os.Stat(TimestampCheck); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
now := time.Now().UTC()
|
||||
return map[string]interface{}{
|
||||
"frontend": stat.ModTime().UTC(),
|
||||
"backend": now,
|
||||
"diffFB": now.Sub(stat.ModTime()),
|
||||
}, nil
|
||||
}
|
||||
}))
|
||||
}
|
||||
Reference in a new issue