string PrettyFormatLease(CloudServiceSchedulingInfo info) { if (!info.LeasedSince.HasValue || !info.LeasedUntil.HasValue) { return "available"; } var now = DateTimeOffset.UtcNow; if (info.LeasedUntil.Value < now) { return "expired"; } if (!info.LeasedBy.HasValue || String.IsNullOrEmpty(info.LeasedBy.Value)) { return String.Format( "{0} ago, expires in {1}", now.Subtract(info.LeasedSince.Value).PrettyFormat(), info.LeasedUntil.Value.Subtract(now).PrettyFormat()); } return String.Format( "by {0} {1} ago, expires in {2}", info.LeasedBy.Value, now.Subtract(info.LeasedSince.Value).PrettyFormat(), info.LeasedUntil.Value.Subtract(now).PrettyFormat()); }
string PrettyFormatLastExecuted(CloudServiceSchedulingInfo info) { if(info.WorkerScoped) { return "untracked"; } return info.LastExecuted.PrettyFormatRelativeToNow(); }