mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 13:15:07 +00:00
refactor: Tidying
This commit is contained in:
@@ -34,13 +34,12 @@ namespace ICD.Common.Utils.Extensions
|
|||||||
/// Returns the closest DateTime to the target time that is greater than the target time
|
/// Returns the closest DateTime to the target time that is greater than the target time
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="target"></param>
|
/// <param name="target"></param>
|
||||||
/// <param name="a"></param>
|
/// <param name="times"></param>
|
||||||
/// <param name="b"></param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static DateTime? NextEarliestTime(this DateTime target, params DateTime[] times)
|
public static DateTime? NextEarliestTime(this DateTime target, params DateTime[] times)
|
||||||
{
|
{
|
||||||
if (times.Length == 0)
|
if (times == null)
|
||||||
return null;
|
throw new ArgumentNullException("times");
|
||||||
|
|
||||||
DateTime earliestTime;
|
DateTime earliestTime;
|
||||||
bool success = times.OrderBy(dt => dt).TryFirst(dt => target < dt, out earliestTime);
|
bool success = times.OrderBy(dt => dt).TryFirst(dt => target < dt, out earliestTime);
|
||||||
@@ -51,13 +50,12 @@ namespace ICD.Common.Utils.Extensions
|
|||||||
/// Returns the closest DateTime to the target time that is less than the target time
|
/// Returns the closest DateTime to the target time that is less than the target time
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="target"></param>
|
/// <param name="target"></param>
|
||||||
/// <param name="a"></param>
|
/// <param name="times"></param>
|
||||||
/// <param name="b"></param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static DateTime? PreviousLatestTime(this DateTime target, params DateTime[] times)
|
public static DateTime? PreviousLatestTime(this DateTime target, params DateTime[] times)
|
||||||
{
|
{
|
||||||
if (times.Length == 0)
|
if (times == null)
|
||||||
return null;
|
throw new ArgumentNullException("null");
|
||||||
|
|
||||||
DateTime latestTime;
|
DateTime latestTime;
|
||||||
bool success = times.OrderByDescending(dt => dt).TryFirst(dt => target > dt, out latestTime);
|
bool success = times.OrderByDescending(dt => dt).TryFirst(dt => target > dt, out latestTime);
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using ICD.Common.Utils.EventArguments;
|
|
||||||
|
|
||||||
namespace ICD.Common.Utils.Services.Scheduler
|
namespace ICD.Common.Utils.Services.Scheduler
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user