using System; namespace Abp.Timing { /// /// Used to perform some common date-time operations. /// public static class Clock { /// /// This object is used to perform all operations. /// Default value: . /// public static IClockProvider Provider { get { return _provider; } set { if (value == null) { throw new ArgumentNullException(nameof(value), "Can not set Clock.Provider to null!"); } _provider = value; } } private static IClockProvider _provider; static Clock() { Provider = ClockProviders.Unspecified; } /// /// Gets Now using current . /// public static DateTime Now => Provider.Now; public static DateTimeKind Kind => Provider.Kind; /// /// Returns true if multiple timezone is supported, returns false if not. /// public static bool SupportsMultipleTimezone => Provider.SupportsMultipleTimezone; /// /// Normalizes given using current . /// /// DateTime to be normalized. /// Normalized DateTime public static DateTime Normalize(DateTime dateTime) { return Provider.Normalize(dateTime); } } }