< Summary - Jellyfin

Information
Class: Jellyfin.Api.Controllers.TimeSyncController
Assembly: Jellyfin.Api
File(s): /srv/git/jellyfin/Jellyfin.Api/Controllers/TimeSyncController.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 3
Coverable lines: 3
Total lines: 33
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
GetUtcTime()100%210%

File(s)

/srv/git/jellyfin/Jellyfin.Api/Controllers/TimeSyncController.cs

#LineLine coverage
 1using System;
 2using MediaBrowser.Model.SyncPlay;
 3using Microsoft.AspNetCore.Http;
 4using Microsoft.AspNetCore.Mvc;
 5
 6namespace Jellyfin.Api.Controllers;
 7
 8/// <summary>
 9/// The time sync controller.
 10/// </summary>
 11[Route("")]
 12public class TimeSyncController : BaseJellyfinApiController
 13{
 14    /// <summary>
 15    /// Gets the current UTC time.
 16    /// </summary>
 17    /// <response code="200">Time returned.</response>
 18    /// <returns>An <see cref="UtcTimeResponse"/> to sync the client and server time.</returns>
 19    [HttpGet("GetUtcTime")]
 20    [ProducesResponseType(statusCode: StatusCodes.Status200OK)]
 21    public ActionResult<UtcTimeResponse> GetUtcTime()
 22    {
 23        // Important to keep the following line at the beginning
 024        var requestReceptionTime = DateTime.UtcNow;
 25
 26        // Important to keep the following line at the end
 027        var responseTransmissionTime = DateTime.UtcNow;
 28
 29        // Implementing NTP on such a high level results in this useless
 30        // information being sent. On the other hand it enables future additions.
 031        return new UtcTimeResponse(requestReceptionTime, responseTransmissionTime);
 32    }
 33}

Methods/Properties

GetUtcTime()