diff --git a/Source/Scheduling/Scheduler.Test.cs b/Source/Scheduling/Scheduler.Test.cs index 1cdf595..e84c967 100644 --- a/Source/Scheduling/Scheduler.Test.cs +++ b/Source/Scheduling/Scheduler.Test.cs @@ -47,6 +47,7 @@ namespace Nuclex.Support.Scheduling { /// Start time in UTC format public MockTimeSource(DateTime utcStartTime) { this.currentTime = utcStartTime; + this.currentTicks = 1000000000; } /// Waits for an AutoResetEvent to become signalled diff --git a/Source/Scheduling/Scheduler.cs b/Source/Scheduling/Scheduler.cs index be4d038..7726b5b 100644 --- a/Source/Scheduling/Scheduler.cs +++ b/Source/Scheduling/Scheduler.cs @@ -128,10 +128,10 @@ namespace Nuclex.Support.Scheduling { } } - #endregion // class NotificationComparer - } + #endregion // class NotificationComparer + /// Initializes a new scheduler using the default time source public Scheduler() : this(DefaultTimeSource) { } @@ -235,7 +235,7 @@ namespace Nuclex.Support.Scheduling { return scheduleNotification( new Notification( 0, - delay.Ticks, + this.timeSource.Ticks + delay.Ticks, DateTime.MinValue, callback ) @@ -256,7 +256,7 @@ namespace Nuclex.Support.Scheduling { return scheduleNotification( new Notification( 0, - (long)delayMilliseconds * TicksPerMillisecond, + this.timeSource.Ticks + ((long)delayMilliseconds * TicksPerMillisecond), DateTime.MinValue, callback ) @@ -276,7 +276,7 @@ namespace Nuclex.Support.Scheduling { return scheduleNotification( new Notification( interval.Ticks, - delay.Ticks, + this.timeSource.Ticks + delay.Ticks, DateTime.MinValue, callback ) @@ -302,7 +302,7 @@ namespace Nuclex.Support.Scheduling { return scheduleNotification( new Notification( (long)intervalMilliseconds * TicksPerMillisecond, - (long)delayMilliseconds * TicksPerMillisecond, + this.timeSource.Ticks + ((long)delayMilliseconds * TicksPerMillisecond), DateTime.MinValue, callback )