Hello,

I am developing a windows service in VS 2005 that will monitor time and do something every 5 seconds.

I have created some code using the stopwatch class. Can anyone tell me if this is the best way to do this .

Code:
protected override void OnStart(string[] args)
        {
            // TODO: Add code here to start your service.
            sw.Start();
            this.RunningTime();
        }

        protected override void OnStop()
        {
            // TODO: Add code here to perform any tear-down necessary to stop your service.
            sw.Stop();
        }

        private void RunningTime()
        {
            if (sw.IsRunning)
            {
                if (sw.Elapsed.Seconds == 5)
                {
                    //Do something here
                }
            }
        }
Many thanks in advance,

Steve