Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented StarTime and Uptime #1617

Merged
Merged
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: 2 additions & 0 deletions src/core/Akka.API.Tests/CoreAPISpec.ApproveCore.approved.txt
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,10 @@ namespace Akka.Actor
public abstract Akka.Actor.IScheduler Scheduler { get; }
public abstract Akka.Serialization.Serialization Serialization { get; }
public abstract Akka.Actor.Settings Settings { get; }
public System.TimeSpan StartTime { get; }
[System.ObsoleteAttribute("Use WhenTerminated instead. This property will be removed in future versions")]
public abstract System.Threading.Tasks.Task TerminationTask { get; }
public System.TimeSpan Uptime { get; }
public abstract System.Threading.Tasks.Task WhenTerminated { get; }
public abstract Akka.Actor.IActorRef ActorOf(Akka.Actor.Props props, string name = null);
public abstract Akka.Actor.ActorSelection ActorSelection(Akka.Actor.ActorPath actorPath);
Expand Down
11 changes: 11 additions & 0 deletions src/core/Akka/Actor/ActorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Akka.Configuration;
using Akka.Dispatch;
using Akka.Event;
using Akka.Util;

namespace Akka.Actor
{
Expand Down Expand Up @@ -73,6 +74,16 @@ public abstract class ActorSystem : IActorRefFactory, IDisposable
/// <summary>Gets the log</summary>
public abstract ILoggingAdapter Log { get; }

/// <summary>
/// Start-up time since the epoch.
/// </summary>
public TimeSpan StartTime { get; } = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

/// <summary>
/// Up-time of this actor system.
/// </summary>
public TimeSpan Uptime => MonotonicClock.ElapsedHighRes;

/// <summary>
/// Creates a new ActorSystem with the specified name, and the specified Config
/// </summary>
Expand Down