< 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: 34
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 1/23/2026 - 12:11:06 AM Line coverage: 0% (0/3) Total lines: 334/27/2026 - 12:15:04 AM Line coverage: 0% (0/3) Total lines: 34

Coverage delta

Coverage delta 1 -1

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("")]
 12[Tags("System")]
 13public class TimeSyncController : BaseJellyfinApiController
 14{
 15    /// <summary>
 16    /// Gets the current UTC time.
 17    /// </summary>
 18    /// <response code="200">Time returned.</response>
 19    /// <returns>An <see cref="UtcTimeResponse"/> to sync the client and server time.</returns>
 20    [HttpGet("GetUtcTime")]
 21    [ProducesResponseType(statusCode: StatusCodes.Status200OK)]
 22    public ActionResult<UtcTimeResponse> GetUtcTime()
 23    {
 24        // Important to keep the following line at the beginning
 025        var requestReceptionTime = DateTime.UtcNow;
 26
 27        // Important to keep the following line at the end
 028        var responseTransmissionTime = DateTime.UtcNow;
 29
 30        // Implementing NTP on such a high level results in this useless
 31        // information being sent. On the other hand it enables future additions.
 032        return new UtcTimeResponse(requestReceptionTime, responseTransmissionTime);
 33    }
 34}

Methods/Properties

GetUtcTime()