Timer on specific time

I need timer which trigger tick event every day at specific hour (my input is hour, minute, second for every day in week).
I tried with ExtendedTimer (ExtendedTimer Constructor (TimerCallback, Object, DateTime, TimeSpan) | Microsoft Learn).
Does anybody know what the third parameters mean?
When will this be triggered:

ExtendedTimer t = new ExtendedTimer(call, null, new DateTime(now.y, now.m, now.d + 1,12, 0, 0),24*3600);

Tommorow at 12:00 or like the msdn say tomorow at 12:00 after a little more then 2013 years? (The System.DateTime value that represents the amount of time the timer will wait before the callback method invokes its methods, in milliseconds. )

To answer my own question:

        void ProgramStarted()
        {
            Debug.Print("Program Started");

            DateTime date = new DateTime(2013, 6, 13, 12, 2, 0);
            Microsoft.SPOT.Hardware.Utility.SetLocalTime(date);


            Microsoft.SPOT.ExtendedTimer timer = new Microsoft.SPOT.ExtendedTimer(call, null, date.AddMinutes(2), new TimeSpan(0, 0, 10));
        }

        public void call(object o)
        {
            Debug.Print("Time: " + DateTime.Now.ToString());
        }

[quote]Program Started
The thread ‘’ (0x3) has exited with code 0 (0x0).
Time: 06/13/2013 12:04:00
Time: 06/13/2013 12:04:10
Time: 06/13/2013 12:04:20
Time: 06/13/2013 12:04:30
Time: 06/13/2013 12:04:40
Time: 06/13/2013 12:04:50
Time: 06/13/2013 12:05:00[/quote]
Exactly what I wanted.

Hmm, maybe what you wanted, but not what you asked for…?

1 Like
ExtendedTimer t = new ExtendedTimer(call, null, new DateTime(now.y, now.m, now.d + 1,12, 0, 0),24*3600);

[quote]When will this be triggered:
Tommorow at 12:00 or like the msdn say tomorow at 12:00 after a little more then 2013 years?
[/quote]

“The System.DateTime value that represents the amount of time”
The amount is crucial here for me. I understood that the timer will wait until the time is passed (all years, months, days, hours, minutes and seconds), not until the time is reached.

If you want it every day then on each tic set it for the next tic. IE plus 1 day.

Yep, a timer set for a specific time only fires once…and you should set a new time in the tic itself.