mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2026-02-16 14:13:46 +00:00
Added GetRestOffsets and GetWebsocketOffsets to TimeOffsetManager
This commit is contained in:
parent
21206ffb25
commit
90c1b89ceb
@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -139,6 +141,26 @@ namespace CryptoExchange.Net
|
||||
/// <param name="api">API name</param>
|
||||
public static TimeSpan? GetSocketOffset(string api) => _lastSocketDelays.TryGetValue(api, out var val) && val.Offset != null ? TimeSpan.FromMilliseconds(val.Offset.Value) : null;
|
||||
|
||||
/// <summary>
|
||||
/// Get a dictionary of API/Client name -> time offset for Rest api's
|
||||
/// </summary>
|
||||
public static Dictionary<string, TimeSpan?> GetRestOffsets()
|
||||
{
|
||||
return _lastRestDelays.ToDictionary(
|
||||
x => x.Key,
|
||||
x => (x.Value.Offset == null ? (TimeSpan?)null : TimeSpan.FromMilliseconds(x.Value.Offset.Value)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a dictionary of API/Client name -> time offset for Websocket api's
|
||||
/// </summary>
|
||||
public static Dictionary<string, TimeSpan?> GetWebsocketOffsets()
|
||||
{
|
||||
return _lastSocketDelays.ToDictionary(
|
||||
x => x.Key,
|
||||
x => (x.Value.Offset == null ? (TimeSpan?)null : TimeSpan.FromMilliseconds(x.Value.Offset.Value)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset the WebSocket API update timestamp to trigger a new time offset calculation
|
||||
/// </summary>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user