summaryrefslogtreecommitdiff
path: root/lib/infrastructure/threading/TimerFactory.cs
blob: d663591ba461155efbf2cf7586cc0b5e2a9cfc30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
using System;

namespace gorilla.infrastructure.threading
{
    public class TimerFactory : ITimerFactory
    {
        public System.Timers.Timer create_for(TimeSpan span)
        {
            if (span.Seconds > 0)
            {
                var milliseconds = span.Seconds*1000;
                return new System.Timers.Timer(milliseconds);
            }
            return new System.Timers.Timer(span.Ticks);
        }
    }
}