main
 1using System;
 2using System.Timers;
 3
 4namespace momoney.service.infrastructure.threading
 5{
 6    public interface ITimerFactory
 7    {
 8        Timer create_for(TimeSpan span);
 9    }
10
11    public class TimerFactory : ITimerFactory
12    {
13        public Timer create_for(TimeSpan span)
14        {
15            if (span.Seconds > 0) {
16                var milliseconds = span.Seconds*1000;
17                return new Timer(milliseconds);
18            }
19            return new Timer(span.Ticks);
20        }
21    }
22}