diff --git a/Library/JobManager.cs b/Library/JobManager.cs index c34c30dd..56f943e3 100644 --- a/Library/JobManager.cs +++ b/Library/JobManager.cs @@ -34,7 +34,20 @@ internal static DateTime Now } #endregion + + #region UTC + /// + /// Use UTC time rather than local time. + /// It's recommended to call this method before any other library interaction to avoid mixed dates. + /// + public static void UseUtcTime() + { + _useUtc = true; + } + + #endregion + #region Job factory private static IJobFactory _jobFactory; @@ -165,7 +178,6 @@ public static void InitializeWithoutStarting(Registry registry) if (registry == null) throw new ArgumentNullException("registry"); - _useUtc = registry.UtcTime; CalculateNextRun(registry.Schedules).ToList().ForEach(RunJob); } diff --git a/Library/Registry.cs b/Library/Registry.cs index 83e151b2..a6f7dae7 100644 --- a/Library/Registry.cs +++ b/Library/Registry.cs @@ -12,8 +12,6 @@ public class Registry { private bool _allJobsConfiguredAsNonReentrant; - internal bool UtcTime { get; private set; } - internal List Schedules { get; private set; } /// @@ -38,14 +36,6 @@ public void NonReentrantAsDefault() } } - /// - /// Use UTC time rather than local time. - /// - public void UseUtcTime() - { - UtcTime = true; - } - /// /// Schedules a new job in the registry. /// diff --git a/README.md b/README.md index 5b5818ca..4f524ba0 100644 --- a/README.md +++ b/README.md @@ -231,7 +231,7 @@ That's why the least interval you can set is one second. Unfortunately, not unlike many schedulers, there is no Daylight Saving Time support yet. If you are worried about your jobs not running or running twice due to that, the suggestion is to avoid troublesome time -ranges or just `UseUtcTime()` in your registry. +ranges or just call `JobManager.UseUtcTime()` before using the library. ## Weekly jobs