473,387 Members | 1,463 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Timer fires a few milliseconds before the actual Due-Time

HL
I am using VS 2005 Beta - C#

Problem: The Timer fires a few milliseconds before the actual Due-Time

Let's say a timer is created in the following manner:
System.Threading.Timer m_timer = null;

Let's declare a constant
Int32 m_TimePeriod = 10000;
In the Initialize method:
m_timer = new System.Threading.Timer(new TimerCallback(XXXTimerProc));
m_timer.Change(m_TimePeriod, 0);
In WndProc of Form:
Get the current time and store in m_dtCurrentTime

// Change the Due-Time and Period to enable the timer
m_timer.Change(m_TimePeriod, 0);
In the XXXTimerProc:
Check if ( Current Time - m_dtCurrrentTime) >= m_TimePeriod
{
// Perform some action

::
::

// Change the Due-Time and Period to disable the timer
m_timer.Change(System.Threading.Timeout.Infinite,
System.Threading.Timeout.Infinite);
}
In the WndProc of the Form, the Timer's Change method is called to set the
DueTime to m_TimePeriod. This enables the timer. But the Timer is fired a few
milliseconds before m_TimePeriod. As a result, In the XXXTimerProc, the
condition for checking the difference between the DateTime values fails and
the neccesary actions do not take place.

Is there something wrong that I am doing or Is it a bug in VS 2005 Beta?
Nov 17 '05 #1
9 7229
Hi,

First of all you will NEVER get the event executed exactly as you
especified, winXX is not a real time OS so what is done when the time to
execute the timer is simply generate an event, the handler will be executed
in a thread frm the threadpool.
As you can imagine all this actions take time.

With that said the comparision if ( Current Time - m_dtCurrrentTime) will
never be exact.
And really don't see the point of the comparision, after all you are calling
this from a timer, what is the point to check the timer elapsed time ?
Why are you calling Change twice , there is where your problem may be.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"HL" <HL@discussions.microsoft.com> wrote in message
news:24**********************************@microsof t.com...
I am using VS 2005 Beta - C#

Problem: The Timer fires a few milliseconds before the actual Due-Time

Let's say a timer is created in the following manner:
System.Threading.Timer m_timer = null;

Let's declare a constant
Int32 m_TimePeriod = 10000;
In the Initialize method:
m_timer = new System.Threading.Timer(new TimerCallback(XXXTimerProc));
m_timer.Change(m_TimePeriod, 0);
In WndProc of Form:
Get the current time and store in m_dtCurrentTime

// Change the Due-Time and Period to enable the timer
m_timer.Change(m_TimePeriod, 0);
In the XXXTimerProc:
Check if ( Current Time - m_dtCurrrentTime) >= m_TimePeriod
{
// Perform some action

::
::

// Change the Due-Time and Period to disable the timer
m_timer.Change(System.Threading.Timeout.Infinite,
System.Threading.Timeout.Infinite);
}
In the WndProc of the Form, the Timer's Change method is called to set the
DueTime to m_TimePeriod. This enables the timer. But the Timer is fired a
few
milliseconds before m_TimePeriod. As a result, In the XXXTimerProc, the
condition for checking the difference between the DateTime values fails
and
the neccesary actions do not take place.

Is there something wrong that I am doing or Is it a bug in VS 2005 Beta?

Nov 17 '05 #2
I have also seen this problem and I haven't found an explanation.

See in-line comments:

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:OR**************@tk2msftngp13.phx.gbl...
Hi,

First of all you will NEVER get the event executed exactly as you
especified, winXX is not a real time OS so what is done when the time to
execute the timer is simply generate an event, the handler will be
executed in a thread frm the threadpool.
As you can imagine all this actions take time.

We realize that Windows isn't a real time OS, I would understand if the
timer went off a few milliseconds too late or even seconds late but, the
problem is it's going off too soon. If I set a timer to go off 50,000
milliseconds from now, why would it go off 49,998 milliseconds from now?
The only explanation that I can think of it that the Windows Time service
adjusts the time forward a few milliseconds but that doesn't affect when
timers we fire. That's just a guess.

With that said the comparision if ( Current Time - m_dtCurrrentTime) will
never be exact.
And really don't see the point of the comparision, after all you are
calling this from a timer, what is the point to check the timer elapsed
time ?
In our case, we have a collection of things that have to happen at specific
times. We walk through that collection and find the nearest time and then
calculate the number of milliseconds between now and the items action time.
Then we set a timer to go off in that number of milliseconds. When the
timer goes off, we walk through the list again expecting to find at least
one item with an action time that has past but, sometimes we don't because
the timer went off a few milliseconds too soon.

In our case, it just means that we reset the time for just a few
milliseconds but I would still like to know what's going on.
John Vottero


Why are you calling Change twice , there is where your problem may be.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"HL" <HL@discussions.microsoft.com> wrote in message
news:24**********************************@microsof t.com...
I am using VS 2005 Beta - C#

Problem: The Timer fires a few milliseconds before the actual Due-Time

Let's say a timer is created in the following manner:
System.Threading.Timer m_timer = null;

Let's declare a constant
Int32 m_TimePeriod = 10000;
In the Initialize method:
m_timer = new System.Threading.Timer(new TimerCallback(XXXTimerProc));
m_timer.Change(m_TimePeriod, 0);
In WndProc of Form:
Get the current time and store in m_dtCurrentTime

// Change the Due-Time and Period to enable the timer
m_timer.Change(m_TimePeriod, 0);
In the XXXTimerProc:
Check if ( Current Time - m_dtCurrrentTime) >= m_TimePeriod
{
// Perform some action

::
::

// Change the Due-Time and Period to disable the timer
m_timer.Change(System.Threading.Timeout.Infinite,
System.Threading.Timeout.Infinite);
}
In the WndProc of the Form, the Timer's Change method is called to set
the
DueTime to m_TimePeriod. This enables the timer. But the Timer is fired a
few
milliseconds before m_TimePeriod. As a result, In the XXXTimerProc, the
condition for checking the difference between the DateTime values fails
and
the neccesary actions do not take place.

Is there something wrong that I am doing or Is it a bug in VS 2005 Beta?


Nov 17 '05 #3
why don't you use a thread instead that runs constantly Sleep(0-1) and
distributes tasks as the come to be? Its the most precise way to do it and
is only a tick more difficult...

"John Vottero" <Jo**@mvpsi.com> schrieb im Newsbeitrag
news:uT**************@TK2MSFTNGP09.phx.gbl...
I have also seen this problem and I haven't found an explanation.

See in-line comments:

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us>
wrote in message news:OR**************@tk2msftngp13.phx.gbl...
Hi,

First of all you will NEVER get the event executed exactly as you
especified, winXX is not a real time OS so what is done when the time to
execute the timer is simply generate an event, the handler will be
executed in a thread frm the threadpool.
As you can imagine all this actions take time.

We realize that Windows isn't a real time OS, I would understand if the
timer went off a few milliseconds too late or even seconds late but, the
problem is it's going off too soon. If I set a timer to go off 50,000
milliseconds from now, why would it go off 49,998 milliseconds from now?
The only explanation that I can think of it that the Windows Time service
adjusts the time forward a few milliseconds but that doesn't affect when
timers we fire. That's just a guess.

With that said the comparision if ( Current Time - m_dtCurrrentTime)
will never be exact.
And really don't see the point of the comparision, after all you are
calling this from a timer, what is the point to check the timer elapsed
time ?


In our case, we have a collection of things that have to happen at
specific times. We walk through that collection and find the nearest time
and then calculate the number of milliseconds between now and the items
action time. Then we set a timer to go off in that number of milliseconds.
When the timer goes off, we walk through the list again expecting to find
at least one item with an action time that has past but, sometimes we
don't because the timer went off a few milliseconds too soon.

In our case, it just means that we reset the time for just a few
milliseconds but I would still like to know what's going on.
John Vottero


Why are you calling Change twice , there is where your problem may be.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"HL" <HL@discussions.microsoft.com> wrote in message
news:24**********************************@microsof t.com...
I am using VS 2005 Beta - C#

Problem: The Timer fires a few milliseconds before the actual Due-Time

Let's say a timer is created in the following manner:
System.Threading.Timer m_timer = null;

Let's declare a constant
Int32 m_TimePeriod = 10000;
In the Initialize method:
m_timer = new System.Threading.Timer(new TimerCallback(XXXTimerProc));
m_timer.Change(m_TimePeriod, 0);
In WndProc of Form:
Get the current time and store in m_dtCurrentTime

// Change the Due-Time and Period to enable the timer
m_timer.Change(m_TimePeriod, 0);
In the XXXTimerProc:
Check if ( Current Time - m_dtCurrrentTime) >= m_TimePeriod
{
// Perform some action

::
::

// Change the Due-Time and Period to disable the timer
m_timer.Change(System.Threading.Timeout.Infinite,
System.Threading.Timeout.Infinite);
}
In the WndProc of the Form, the Timer's Change method is called to set
the
DueTime to m_TimePeriod. This enables the timer. But the Timer is fired
a few
milliseconds before m_TimePeriod. As a result, In the XXXTimerProc, the
condition for checking the difference between the DateTime values fails
and
the neccesary actions do not take place.

Is there something wrong that I am doing or Is it a bug in VS 2005 Beta?



Nov 17 '05 #4
"Robert Heuvel" <ro***********@isopass.com> wrote in message
news:uf**************@TK2MSFTNGP12.phx.gbl...
why don't you use a thread instead that runs constantly Sleep(0-1) and
distributes tasks as the come to be? Its the most precise way to do it and
is only a tick more difficult...
I don't see why that would solve the problem. If I calculate the number of
milliseconds until 1:00:00.0000 and do a Sleep(thatNumber) I could still
wake from the sleep to find that it's 12:59:59.9773.

"John Vottero" <Jo**@mvpsi.com> schrieb im Newsbeitrag
news:uT**************@TK2MSFTNGP09.phx.gbl...
I have also seen this problem and I haven't found an explanation.

See in-line comments:

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us>
wrote in message news:OR**************@tk2msftngp13.phx.gbl...
Hi,

First of all you will NEVER get the event executed exactly as you
especified, winXX is not a real time OS so what is done when the time to
execute the timer is simply generate an event, the handler will be
executed in a thread frm the threadpool.
As you can imagine all this actions take time.

We realize that Windows isn't a real time OS, I would understand if the
timer went off a few milliseconds too late or even seconds late but, the
problem is it's going off too soon. If I set a timer to go off 50,000
milliseconds from now, why would it go off 49,998 milliseconds from now?
The only explanation that I can think of it that the Windows Time service
adjusts the time forward a few milliseconds but that doesn't affect when
timers we fire. That's just a guess.

With that said the comparision if ( Current Time - m_dtCurrrentTime)
will never be exact.
And really don't see the point of the comparision, after all you are
calling this from a timer, what is the point to check the timer elapsed
time ?


In our case, we have a collection of things that have to happen at
specific times. We walk through that collection and find the nearest
time and then calculate the number of milliseconds between now and the
items action time. Then we set a timer to go off in that number of
milliseconds. When the timer goes off, we walk through the list again
expecting to find at least one item with an action time that has past
but, sometimes we don't because the timer went off a few milliseconds too
soon.

In our case, it just means that we reset the time for just a few
milliseconds but I would still like to know what's going on.
John Vottero


Why are you calling Change twice , there is where your problem may be.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"HL" <HL@discussions.microsoft.com> wrote in message
news:24**********************************@microsof t.com...
I am using VS 2005 Beta - C#

Problem: The Timer fires a few milliseconds before the actual Due-Time

Let's say a timer is created in the following manner:
System.Threading.Timer m_timer = null;

Let's declare a constant
Int32 m_TimePeriod = 10000;
In the Initialize method:
m_timer = new System.Threading.Timer(new TimerCallback(XXXTimerProc));
m_timer.Change(m_TimePeriod, 0);
In WndProc of Form:
Get the current time and store in m_dtCurrentTime

// Change the Due-Time and Period to enable the timer
m_timer.Change(m_TimePeriod, 0);
In the XXXTimerProc:
Check if ( Current Time - m_dtCurrrentTime) >= m_TimePeriod
{
// Perform some action

::
::

// Change the Due-Time and Period to disable the timer
m_timer.Change(System.Threading.Timeout.Infinite,
System.Threading.Timeout.Infinite);
}
In the WndProc of the Form, the Timer's Change method is called to set
the
DueTime to m_TimePeriod. This enables the timer. But the Timer is fired
a few
milliseconds before m_TimePeriod. As a result, In the XXXTimerProc, the
condition for checking the difference between the DateTime values fails
and
the neccesary actions do not take place.

Is there something wrong that I am doing or Is it a bug in VS 2005
Beta?



Nov 17 '05 #5
HL
Hi,

Well, regarding the Change event being called twice: After the timer is
fired, it is disabled. Subsequently, On receiving a message in the WndProc of
the Form, I would like to enable the timer. Hence the Change event is called
twice - once to disable the timer and the next time to enable it.

I can understand if the timer fires a millisconds later than the actual
time. But the problem is that it fires a few milliseconds before the actual
time. Anybody to help out?

Thanks.

"John Vottero" wrote:
"Robert Heuvel" <ro***********@isopass.com> wrote in message
news:uf**************@TK2MSFTNGP12.phx.gbl...
why don't you use a thread instead that runs constantly Sleep(0-1) and
distributes tasks as the come to be? Its the most precise way to do it and
is only a tick more difficult...


I don't see why that would solve the problem. If I calculate the number of
milliseconds until 1:00:00.0000 and do a Sleep(thatNumber) I could still
wake from the sleep to find that it's 12:59:59.9773.

"John Vottero" <Jo**@mvpsi.com> schrieb im Newsbeitrag
news:uT**************@TK2MSFTNGP09.phx.gbl...
I have also seen this problem and I haven't found an explanation.

See in-line comments:

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us>
wrote in message news:OR**************@tk2msftngp13.phx.gbl...
Hi,

First of all you will NEVER get the event executed exactly as you
especified, winXX is not a real time OS so what is done when the time to
execute the timer is simply generate an event, the handler will be
executed in a thread frm the threadpool.
As you can imagine all this actions take time.
We realize that Windows isn't a real time OS, I would understand if the
timer went off a few milliseconds too late or even seconds late but, the
problem is it's going off too soon. If I set a timer to go off 50,000
milliseconds from now, why would it go off 49,998 milliseconds from now?
The only explanation that I can think of it that the Windows Time service
adjusts the time forward a few milliseconds but that doesn't affect when
timers we fire. That's just a guess.
With that said the comparision if ( Current Time - m_dtCurrrentTime)
will never be exact.
And really don't see the point of the comparision, after all you are
calling this from a timer, what is the point to check the timer elapsed
time ?

In our case, we have a collection of things that have to happen at
specific times. We walk through that collection and find the nearest
time and then calculate the number of milliseconds between now and the
items action time. Then we set a timer to go off in that number of
milliseconds. When the timer goes off, we walk through the list again
expecting to find at least one item with an action time that has past
but, sometimes we don't because the timer went off a few milliseconds too
soon.

In our case, it just means that we reset the time for just a few
milliseconds but I would still like to know what's going on.
John Vottero

Why are you calling Change twice , there is where your problem may be.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"HL" <HL@discussions.microsoft.com> wrote in message
news:24**********************************@microsof t.com...
>I am using VS 2005 Beta - C#
>
> Problem: The Timer fires a few milliseconds before the actual Due-Time
>
> Let's say a timer is created in the following manner:
> System.Threading.Timer m_timer = null;
>
> Let's declare a constant
> Int32 m_TimePeriod = 10000;
>
>
> In the Initialize method:
> m_timer = new System.Threading.Timer(new TimerCallback(XXXTimerProc));
> m_timer.Change(m_TimePeriod, 0);
>
>
> In WndProc of Form:
> Get the current time and store in m_dtCurrentTime
>
> // Change the Due-Time and Period to enable the timer
> m_timer.Change(m_TimePeriod, 0);
>
>
> In the XXXTimerProc:
> Check if ( Current Time - m_dtCurrrentTime) >= m_TimePeriod
> {
> // Perform some action
>
> ::
> ::
>
> // Change the Due-Time and Period to disable the timer
> m_timer.Change(System.Threading.Timeout.Infinite,
> System.Threading.Timeout.Infinite);
> }
>
>
> In the WndProc of the Form, the Timer's Change method is called to set
> the
> DueTime to m_TimePeriod. This enables the timer. But the Timer is fired
> a few
> milliseconds before m_TimePeriod. As a result, In the XXXTimerProc, the
> condition for checking the difference between the DateTime values fails
> and
> the neccesary actions do not take place.
>
> Is there something wrong that I am doing or Is it a bug in VS 2005
> Beta?
>
>



Nov 17 '05 #6

"HL" <HL@discussions.microsoft.com> wrote in message
news:24**********************************@microsof t.com...
I am using VS 2005 Beta - C#

Problem: The Timer fires a few milliseconds before the actual Due-Time

Let's say a timer is created in the following manner:
System.Threading.Timer m_timer = null;

Let's declare a constant
Int32 m_TimePeriod = 10000;
In the Initialize method:
m_timer = new System.Threading.Timer(new TimerCallback(XXXTimerProc));
m_timer.Change(m_TimePeriod, 0);
In WndProc of Form:
Get the current time and store in m_dtCurrentTime

// Change the Due-Time and Period to enable the timer
m_timer.Change(m_TimePeriod, 0);
In the XXXTimerProc:
Check if ( Current Time - m_dtCurrrentTime) >= m_TimePeriod
{
// Perform some action

::
::

// Change the Due-Time and Period to disable the timer
m_timer.Change(System.Threading.Timeout.Infinite,
System.Threading.Timeout.Infinite);
}
In the WndProc of the Form, the Timer's Change method is called to set the
DueTime to m_TimePeriod. This enables the timer. But the Timer is fired a
few
milliseconds before m_TimePeriod. As a result, In the XXXTimerProc, the
condition for checking the difference between the DateTime values fails
and
the neccesary actions do not take place.

Is there something wrong that I am doing or Is it a bug in VS 2005 Beta?

All timers in the Framework are using the System clock as timer source, this
clock has a (system wide default) resolution of x milliseconds (where x is
10 msec. on most X86 based hardware) - that means that the clock changes
(fires) every x (10) msec.
Say you initialize a timer to fire after 10 seconds, and say this happens 2
msec. after the last system clock tick, that means that the timer counts
10000 ticks before it fires, that is after 8 msec. (to the first tick) +
9999 * 10 msec = 9999.8 msec.
When you initialize the timer, your current system time is the time of the
system clock at the last tick, that is the timer initialization time - 2
msec, lets call it t1. When the timer fires the current time is the same as
the time of the system clock, that is 10000 clock ticks after t1 or exactly
10000 msec. That means that your timer interval will always be up to x - 1
msec. less than the wanted interval.
What you could do to solve your problem (though I don't get why you are
doing this) is correct the start time by adding the clock interval to the
start time t1 (your m_dtCurrentTime).

Willy.

Nov 17 '05 #7
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:uS**************@TK2MSFTNGP15.phx.gbl...
[snip]
All timers in the Framework are using the System clock as timer source,
this clock has a (system wide default) resolution of x milliseconds (where
x is 10 msec. on most X86 based hardware) - that means that the clock
changes (fires) every x (10) msec.
Say you initialize a timer to fire after 10 seconds, and say this happens
2 msec. after the last system clock tick, that means that the timer counts
10000 ticks before it fires, that is after 8 msec. (to the first tick) +
9999 * 10 msec = 9999.8 msec.
When you initialize the timer, your current system time is the time of the
system clock at the last tick, that is the timer initialization time - 2
msec, lets call it t1. When the timer fires the current time is the same
as the time of the system clock, that is 10000 clock ticks after t1 or
exactly 10000 msec. That means that your timer interval will always be up
to x - 1 msec. less than the wanted interval.
What you could do to solve your problem (though I don't get why you are
doing this) is correct the start time by adding the clock interval to the
start time t1 (your m_dtCurrentTime).


Thanks. Is there a way to get the clock interval? Is it a fairly safe bet
that the clock interval will always be <= 10ms?

Nov 17 '05 #8

"John Vottero" <Jo**@mvpsi.com> wrote in message
news:OP**************@TK2MSFTNGP12.phx.gbl...
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:uS**************@TK2MSFTNGP15.phx.gbl...

[snip]

All timers in the Framework are using the System clock as timer source,
this clock has a (system wide default) resolution of x milliseconds
(where x is 10 msec. on most X86 based hardware) - that means that the
clock changes (fires) every x (10) msec.
Say you initialize a timer to fire after 10 seconds, and say this happens
2 msec. after the last system clock tick, that means that the timer
counts 10000 ticks before it fires, that is after 8 msec. (to the first
tick) + 9999 * 10 msec = 9999.8 msec.
When you initialize the timer, your current system time is the time of
the system clock at the last tick, that is the timer initialization
time - 2 msec, lets call it t1. When the timer fires the current time is
the same as the time of the system clock, that is 10000 clock ticks after
t1 or exactly 10000 msec. That means that your timer interval will always
be up to x - 1 msec. less than the wanted interval.
What you could do to solve your problem (though I don't get why you are
doing this) is correct the start time by adding the clock interval to the
start time t1 (your m_dtCurrentTime).


Thanks. Is there a way to get the clock interval? Is it a fairly safe
bet that the clock interval will always be <= 10ms?


Yep, using PInvoke...

[DllImport("kernel32.dll")]
extern static int GetSystemTimeAdjustment(out uint lpTimeAdjustment,
out uint lpTimeIncrement, out bool lpTimeAdjustmentDisabled);

....
GetSystemTimeAdjustment(out adjustment,
out clockInterval,
out adjustmentDisabled );

clockInterval returns the clock interval in 100 nsec. units. Divide this
number by 1000 to get the msec. timer interval.

Willy.
Nov 17 '05 #9
HL
Thanks Willy. The solution was very nicely explained.

"Willy Denoyette [MVP]" wrote:

"John Vottero" <Jo**@mvpsi.com> wrote in message
news:OP**************@TK2MSFTNGP12.phx.gbl...
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:uS**************@TK2MSFTNGP15.phx.gbl...

[snip]

All timers in the Framework are using the System clock as timer source,
this clock has a (system wide default) resolution of x milliseconds
(where x is 10 msec. on most X86 based hardware) - that means that the
clock changes (fires) every x (10) msec.
Say you initialize a timer to fire after 10 seconds, and say this happens
2 msec. after the last system clock tick, that means that the timer
counts 10000 ticks before it fires, that is after 8 msec. (to the first
tick) + 9999 * 10 msec = 9999.8 msec.
When you initialize the timer, your current system time is the time of
the system clock at the last tick, that is the timer initialization
time - 2 msec, lets call it t1. When the timer fires the current time is
the same as the time of the system clock, that is 10000 clock ticks after
t1 or exactly 10000 msec. That means that your timer interval will always
be up to x - 1 msec. less than the wanted interval.
What you could do to solve your problem (though I don't get why you are
doing this) is correct the start time by adding the clock interval to the
start time t1 (your m_dtCurrentTime).


Thanks. Is there a way to get the clock interval? Is it a fairly safe
bet that the clock interval will always be <= 10ms?


Yep, using PInvoke...

[DllImport("kernel32.dll")]
extern static int GetSystemTimeAdjustment(out uint lpTimeAdjustment,
out uint lpTimeIncrement, out bool lpTimeAdjustmentDisabled);

....
GetSystemTimeAdjustment(out adjustment,
out clockInterval,
out adjustmentDisabled );

clockInterval returns the clock interval in 100 nsec. units. Divide this
number by 1000 to get the msec. timer interval.

Willy.

Nov 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: David | last post by:
Hi There! I'm using Timer control to record how long my application perform certain tasks. However, apparently Timer control is not doing its' job (i.e. Not firing Tick event) while my...
2
by: Ryan Moore | last post by:
is there any way to get a more accurate version of the timer? Basically what I need it to do something every 33 milliseconds, but for some reason, setting the timer.Interval=33 does not ensure that...
6
by: Dan | last post by:
I've created a pocketpc app which has a startup form containing a listview. The form creates an object which in turn creates a System.Threading.Timer. It keeps track of the Timer state using a...
6
by: whtinkm | last post by:
Hi, All Recently, my project need some code like following: using System; using System.Threading; namespace MyTimerTest { class Class1 {
6
by: Antti Laakso | last post by:
Hi i have function like above Public Sub halytystutkinta() Dim ds As New DataSet ds = dl2.HaeHalytys() Dim onkohal As Int16 onkohal = ds.Tables(0).Rows(0).Item("onkohalytys") halid =...
5
by: csgraham74 | last post by:
HI all, I want to implement this scenario: I need my ASP.NET website to check a SQL table every 30 seconds and if there is a change to display a message to user. I have created a panel control...
2
by: Myo Zaw | last post by:
hi, i have a windows service which is checking to the desire URL and check back its httpwebresponse data. and, i save the result in a log file insdie local drive. i use a timer to trigger my...
8
by: TheMadHatter | last post by:
Yello, Quick Q: I created a windows service that changes some data every (approx) 1sec, but currently it is using a loop on a separate thread that uses Thread.Sleep(1000). Is that bad...
10
by: igor | last post by:
I have recently discovered that the system.Timers.Timer from.Net Framework v1.1 is not reliable when used on Windows 2003 server. When incorporated into a Windows Service, the timer_elapsed event...
8
by: =?Utf-8?B?RGF2ZSBCb29rZXI=?= | last post by:
I have a Timer that I set to go off once a day, but it frequently fails! In order to debug I would like to be able to check, at any moment, whether the Timer is enabled and when it will next...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.