fix: 前端时钟校准问题
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import time
|
||||
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.http import HttpResponse, StreamingHttpResponse
|
||||
@@ -31,6 +32,20 @@ def network_latest(request):
|
||||
return Response(network_service.get_latest())
|
||||
|
||||
|
||||
@api_view(["GET"])
|
||||
def clock_calibration(request):
|
||||
server_received_unix_ns = time.time_ns()
|
||||
server_sent_unix_ns = time.time_ns()
|
||||
response = Response(
|
||||
{
|
||||
"server_received_unix_ms": round(server_received_unix_ns / 1_000_000.0, 3),
|
||||
"server_sent_unix_ms": round(server_sent_unix_ns / 1_000_000.0, 3),
|
||||
}
|
||||
)
|
||||
response["Cache-Control"] = "no-store, no-cache, must-revalidate, max-age=0"
|
||||
return response
|
||||
|
||||
|
||||
@api_view(["GET"])
|
||||
def video_status(request):
|
||||
return Response(video_service.get_status())
|
||||
|
||||
Reference in New Issue
Block a user