Skip to content

Commit

Permalink
Revert "Fix DateTimeOffset.DateTime UTC bug (akkadotnet#7349)"
Browse files Browse the repository at this point in the history
This reverts commit 33fd92d.
  • Loading branch information
Arkatufus committed Oct 3, 2024
1 parent 6e860b5 commit f682c38
Show file tree
Hide file tree
Showing 12 changed files with 3 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,6 @@ namespace Akka.Actor
[System.ObsoleteAttribute("This class will be removed in Akka.NET v1.6.0 - use the IScheduler instead.")]
public class DateTimeOffsetNowTimeProvider : Akka.Actor.IDateTimeOffsetNowTimeProvider, Akka.Actor.ITimeProvider
{
public System.DateTime DateTimeNow { get; }
public System.TimeSpan HighResMonotonicClock { get; }
public static Akka.Actor.DateTimeOffsetNowTimeProvider Instance { get; }
public System.TimeSpan MonotonicClock { get; }
Expand Down Expand Up @@ -933,7 +932,6 @@ namespace Akka.Actor
public sealed class HashedWheelTimerScheduler : Akka.Actor.SchedulerBase, Akka.Actor.IDateTimeOffsetNowTimeProvider, Akka.Actor.ITimeProvider, System.IDisposable
{
public HashedWheelTimerScheduler(Akka.Configuration.Config scheduler, Akka.Event.ILoggingAdapter log) { }
protected override System.DateTime DateTimeNow { get; }
public override System.TimeSpan HighResMonotonicClock { get; }
public override System.TimeSpan MonotonicClock { get; }
protected override System.DateTimeOffset TimeNow { get; }
Expand Down Expand Up @@ -1174,7 +1172,6 @@ namespace Akka.Actor
}
public interface ITimeProvider
{
System.DateTime DateTimeNow { get; }
System.TimeSpan HighResMonotonicClock { get; }
System.TimeSpan MonotonicClock { get; }
System.DateTimeOffset Now { get; }
Expand Down Expand Up @@ -1625,7 +1622,6 @@ namespace Akka.Actor
protected readonly Akka.Event.ILoggingAdapter Log;
protected readonly Akka.Configuration.Config SchedulerConfig;
protected SchedulerBase(Akka.Configuration.Config scheduler, Akka.Event.ILoggingAdapter log) { }
protected abstract System.DateTime DateTimeNow { get; }
public abstract System.TimeSpan HighResMonotonicClock { get; }
public abstract System.TimeSpan MonotonicClock { get; }
protected abstract System.DateTimeOffset TimeNow { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,6 @@ namespace Akka.Actor
[System.ObsoleteAttribute("This class will be removed in Akka.NET v1.6.0 - use the IScheduler instead.")]
public class DateTimeOffsetNowTimeProvider : Akka.Actor.IDateTimeOffsetNowTimeProvider, Akka.Actor.ITimeProvider
{
public System.DateTime DateTimeNow { get; }
public System.TimeSpan HighResMonotonicClock { get; }
public static Akka.Actor.DateTimeOffsetNowTimeProvider Instance { get; }
public System.TimeSpan MonotonicClock { get; }
Expand Down Expand Up @@ -931,7 +930,6 @@ namespace Akka.Actor
public sealed class HashedWheelTimerScheduler : Akka.Actor.SchedulerBase, Akka.Actor.IDateTimeOffsetNowTimeProvider, Akka.Actor.ITimeProvider, System.IDisposable
{
public HashedWheelTimerScheduler(Akka.Configuration.Config scheduler, Akka.Event.ILoggingAdapter log) { }
protected override System.DateTime DateTimeNow { get; }
public override System.TimeSpan HighResMonotonicClock { get; }
public override System.TimeSpan MonotonicClock { get; }
protected override System.DateTimeOffset TimeNow { get; }
Expand Down Expand Up @@ -1172,7 +1170,6 @@ namespace Akka.Actor
}
public interface ITimeProvider
{
System.DateTime DateTimeNow { get; }
System.TimeSpan HighResMonotonicClock { get; }
System.TimeSpan MonotonicClock { get; }
System.DateTimeOffset Now { get; }
Expand Down Expand Up @@ -1623,7 +1620,6 @@ namespace Akka.Actor
protected readonly Akka.Event.ILoggingAdapter Log;
protected readonly Akka.Configuration.Config SchedulerConfig;
protected SchedulerBase(Akka.Configuration.Config scheduler, Akka.Event.ILoggingAdapter log) { }
protected abstract System.DateTime DateTimeNow { get; }
public abstract System.TimeSpan HighResMonotonicClock { get; }
public abstract System.TimeSpan MonotonicClock { get; }
protected abstract System.DateTimeOffset TimeNow { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,6 @@ namespace Akka.TestKit
{
public TestScheduler(Akka.Configuration.Config schedulerConfig, Akka.Event.ILoggingAdapter log) { }
public Akka.Actor.IAdvancedScheduler Advanced { get; }
public System.DateTime DateTimeNow { get; }
public System.TimeSpan HighResMonotonicClock { get; }
public System.TimeSpan MonotonicClock { get; }
public System.DateTimeOffset Now { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,6 @@ namespace Akka.TestKit
{
public TestScheduler(Akka.Configuration.Config schedulerConfig, Akka.Event.ILoggingAdapter log) { }
public Akka.Actor.IAdvancedScheduler Advanced { get; }
public System.DateTime DateTimeNow { get; }
public System.TimeSpan HighResMonotonicClock { get; }
public System.TimeSpan MonotonicClock { get; }
public System.DateTimeOffset Now { get; }
Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Persistence/Eventsourced.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public void LoadSnapshot(string persistenceId, SnapshotSelectionCriteria criteri
/// <param name="snapshot">TBD</param>
public void SaveSnapshot(object snapshot)
{
SnapshotStore.Tell(new SaveSnapshot(new SnapshotMetadata(SnapshotterId, SnapshotSequenceNr, Context.System.Scheduler.DateTimeNow), snapshot));
SnapshotStore.Tell(new SaveSnapshot(new SnapshotMetadata(SnapshotterId, SnapshotSequenceNr, Context.System.Scheduler.Now.Date), snapshot));
}

/// <summary>
Expand Down
4 changes: 0 additions & 4 deletions src/core/Akka.TestKit/TestScheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,6 @@ public void ScheduleRepeatedly(TimeSpan initialDelay, TimeSpan interval, Action
/// <summary>
/// TBD
/// </summary>
public DateTime DateTimeNow { get { return DateTime.SpecifyKind(_now.DateTime, DateTimeKind.Utc); } }
/// <summary>
/// TBD
/// </summary>
public TimeSpan MonotonicClock { get { return Util.MonotonicClock.Elapsed; } }
/// <summary>
/// TBD
Expand Down
1 change: 0 additions & 1 deletion src/core/Akka.Tests/Actor/ActorSystemSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,6 @@ public void ScheduleTellRepeatedly(TimeSpan initialDelay, TimeSpan interval, ICa
}

public DateTimeOffset Now { get; private set; }
public DateTime DateTimeNow { get; private set; }
public TimeSpan MonotonicClock { get; private set; }
public TimeSpan HighResMonotonicClock { get; private set; }
public IAdvancedScheduler Advanced { get; private set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ private class ShutdownScheduler : SchedulerBase, IDisposable


protected override DateTimeOffset TimeNow { get; }
protected override DateTime DateTimeNow { get; }
public override TimeSpan MonotonicClock { get; }
public override TimeSpan HighResMonotonicClock { get; }

Expand Down
2 changes: 0 additions & 2 deletions src/core/Akka/Actor/Scheduler/DateTimeNowTimeProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ private DateTimeOffsetNowTimeProvider() { }

public DateTimeOffset Now { get { return DateTimeOffset.UtcNow; } }

public DateTime DateTimeNow => DateTime.UtcNow;

public TimeSpan MonotonicClock {get { return Util.MonotonicClock.Elapsed; }}

public TimeSpan HighResMonotonicClock{get { return Util.MonotonicClock.ElapsedHighRes; }}
Expand Down
5 changes: 0 additions & 5 deletions src/core/Akka/Actor/Scheduler/HashedWheelTimerScheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,6 @@ private void PlaceInBucket(SchedulerRegistration reg)
/// </summary>
protected override DateTimeOffset TimeNow => DateTimeOffset.UtcNow;

/// <summary>
/// TBD
/// </summary>
protected override DateTime DateTimeNow => DateTime.UtcNow;

/// <summary>
/// TBD
/// </summary>
Expand Down
6 changes: 1 addition & 5 deletions src/core/Akka/Actor/Scheduler/ITimeProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,10 @@ namespace Akka.Actor
public interface ITimeProvider
{
/// <summary>
/// Gets the scheduler's notion of current time in <see cref="DateTimeOffset"/>.
/// Gets the scheduler's notion of current time.
/// </summary>
DateTimeOffset Now { get; }
/// <summary>
/// Gets the scheduler's notion of current time in <see cref="DateTime"/>.
/// </summary>
DateTime DateTimeNow { get; }
/// <summary>
/// TBD
/// </summary>
TimeSpan MonotonicClock { get; }
Expand Down
9 changes: 1 addition & 8 deletions src/core/Akka/Actor/Scheduler/SchedulerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,11 @@ void IActionScheduler.ScheduleRepeatedly(TimeSpan initialDelay, TimeSpan interva
IAdvancedScheduler IScheduler.Advanced { get { return this; } }
DateTimeOffset ITimeProvider.Now { get { return TimeNow; } }

DateTime ITimeProvider.DateTimeNow => DateTime.SpecifyKind(TimeNow.DateTime, DateTimeKind.Utc);

/// <summary>
/// The current time in <see cref="DateTimeOffset"/> UTC.
/// The current time in UTC.
/// </summary>
protected abstract DateTimeOffset TimeNow { get; }

/// <summary>
/// The current time in <see cref="DateTime"/> UTC.
/// </summary>
protected abstract DateTime DateTimeNow { get; }

/// <summary>
/// The current time since startup, as determined by the monotonic clock implementation.
/// </summary>
Expand Down

0 comments on commit f682c38

Please sign in to comment.