Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/SampSharp.Entities/Timers/TimerReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ internal TimerReference(TimerInfo info, object target, MethodInfo method)
}

/// <summary>Gets the time span until the next tick of this timer.</summary>
public TimeSpan NextTick => new(Info.NextTick - Stopwatch.GetTimestamp());
public TimeSpan NextTick => new(Info.NextTick - DateTime.UtcNow.Ticks);

internal TimerInfo Info { get; set; }

Expand Down
6 changes: 3 additions & 3 deletions src/SampSharp.Entities/Timers/TimerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public TimerReference Start(Action<IServiceProvider, TimerReference> action, Tim
{
IsActive = true,
IntervalTicks = interval.Ticks,
NextTick = Stopwatch.GetTimestamp() + interval.Ticks
NextTick = DateTime.UtcNow.Ticks + interval.Ticks
};

var reference = new TimerReference(invoker, null, null);
Expand All @@ -79,7 +79,7 @@ public TimerReference Start(Action<IServiceProvider, TimerReference> action, Tim
[Event]
internal void OnGameModeInit()
{
_lastTick = Stopwatch.GetTimestamp();
_lastTick = DateTime.UtcNow.Ticks;

CreateTimersFromAssemblies(_lastTick);

Expand All @@ -92,7 +92,7 @@ public void Tick()
if (!_didInitialize || _timers.Count == 0)
return;

var timestamp = Stopwatch.GetTimestamp();
var timestamp = DateTime.UtcNow.Ticks;

// Don't user foreach for performance reasons
// ReSharper disable once ForCanBeConvertedToForeach
Expand Down
Loading