mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2025-06-07 16:06:15 +00:00
Re-added recalculation interval
This commit is contained in:
parent
1df63ab60c
commit
6eb43c5218
@ -65,7 +65,7 @@ namespace CryptoExchange.Net
|
|||||||
var timeSyncParams = GetTimeSyncInfo();
|
var timeSyncParams = GetTimeSyncInfo();
|
||||||
if (await timeSyncParams.TimeSyncState.Semaphore.WaitAsync(0).ConfigureAwait(false))
|
if (await timeSyncParams.TimeSyncState.Semaphore.WaitAsync(0).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
if (!timeSyncParams.SyncTime || (DateTime.UtcNow - timeSyncParams.TimeSyncState.LastSyncTime < TimeSpan.FromHours(1)))
|
if (!timeSyncParams.SyncTime || (DateTime.UtcNow - timeSyncParams.TimeSyncState.LastSyncTime < timeSyncParams.RecalculationInterval))
|
||||||
{
|
{
|
||||||
timeSyncParams.TimeSyncState.Semaphore.Release();
|
timeSyncParams.TimeSyncState.Semaphore.Release();
|
||||||
return new WebCallResult<bool>(null, null, null, null, null, null, null, null, true, null);
|
return new WebCallResult<bool>(null, null, null, null, null, null, null, null, true, null);
|
||||||
|
@ -280,6 +280,11 @@ namespace CryptoExchange.Net.Objects
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool AutoTimestamp { get; set; }
|
public bool AutoTimestamp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// How often the timestamp adjustment between client and server is recalculated. If you need a very small TimeSpan here you're probably better of syncing your server time more often
|
||||||
|
/// </summary>
|
||||||
|
public TimeSpan TimestampRecalculationInterval { get; set; } = TimeSpan.FromHours(1);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ctor
|
/// ctor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -318,12 +323,13 @@ namespace CryptoExchange.Net.Objects
|
|||||||
input.RateLimiters = def.RateLimiters.ToList();
|
input.RateLimiters = def.RateLimiters.ToList();
|
||||||
input.RateLimitingBehaviour = def.RateLimitingBehaviour;
|
input.RateLimitingBehaviour = def.RateLimitingBehaviour;
|
||||||
input.AutoTimestamp = def.AutoTimestamp;
|
input.AutoTimestamp = def.AutoTimestamp;
|
||||||
|
input.TimestampRecalculationInterval = def.TimestampRecalculationInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return $"{base.ToString()}, RateLimiters: {RateLimiters?.Count}, RateLimitBehaviour: {RateLimitingBehaviour}, AutoTimestamp: {AutoTimestamp}";
|
return $"{base.ToString()}, RateLimiters: {RateLimiters?.Count}, RateLimitBehaviour: {RateLimitingBehaviour}, AutoTimestamp: {AutoTimestamp}, TimestampRecalculationInterval: {TimestampRecalculationInterval}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +46,10 @@ namespace CryptoExchange.Net.Objects
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool SyncTime { get; }
|
public bool SyncTime { get; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Timestamp recalulcation interval
|
||||||
|
/// </summary>
|
||||||
|
public TimeSpan RecalculationInterval { get; }
|
||||||
|
/// <summary>
|
||||||
/// Time sync state for the API client
|
/// Time sync state for the API client
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TimeSyncState TimeSyncState { get; }
|
public TimeSyncState TimeSyncState { get; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user