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

namespace jive
{
  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);
    }
  }
}