Return and pass around clock skew to be used in latency calculations.

Closes #1920
This commit is contained in:
Gabe Kangas
2022-05-23 15:15:32 -07:00
parent ade4d68c0d
commit afeef6f276
5 changed files with 52 additions and 20 deletions

View File

@@ -3,6 +3,7 @@ package controllers
import (
"encoding/json"
"net/http"
"time"
"github.com/owncast/owncast/core"
"github.com/owncast/owncast/router/middleware"
@@ -17,6 +18,7 @@ func GetStatus(w http.ResponseWriter, r *http.Request) {
response := webStatusResponse{
Online: status.Online,
ViewerCount: status.ViewerCount,
ServerTime: time.Now(),
LastConnectTime: status.LastConnectTime,
LastDisconnectTime: status.LastDisconnectTime,
VersionNumber: status.VersionNumber,
@@ -32,9 +34,9 @@ func GetStatus(w http.ResponseWriter, r *http.Request) {
}
type webStatusResponse struct {
Online bool `json:"online"`
ViewerCount int `json:"viewerCount"`
Online bool `json:"online"`
ViewerCount int `json:"viewerCount"`
ServerTime time.Time `json:"serverTime"`
LastConnectTime *utils.NullTime `json:"lastConnectTime"`
LastDisconnectTime *utils.NullTime `json:"lastDisconnectTime"`