Because your value was greater than 2^31 - 1, the system is trying to
convert an integer to a double. In this case, it's folding over itself and
is most likely being represented as a negative number. Try adding a "D" to
end of the number and see what happens.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."
[quoted text, click to view] "DaemonOnMe" <DaemonOnMe@discussions.microsoft.com> wrote in message
news:F657AABF-70BD-4227-AE28-C5617A61029D@microsoft.com...
> Hi,
>
> I ran into a problem of assigning a double value to the
> Sytem.Timers.Interval.
> The code is below
>
> namespace TimerProblem
> {
> /// <summary>
> /// Summary description for Class1.
> /// </summary>
> class Class1
> {
> /// <summary>
> /// The main entry point for the application.
> /// </summary>
> [STAThread]
> static void Main(string[] args)
> {
> double temp = 19998441727;
> Timer timer = new Timer();
> timer.Elapsed += new ElapsedEventHandler(Foo);
> timer.Enabled = true;
> timer.Interval = temp;
> }
>
> private static void Foo(object source, ElapsedEventArgs e)
> {
>
> }
> }
> }
>
> The error message is
> Unhandled Exception: System.ArgumentOutOfRangeException: Number must be
> either non-negative or -1.
> Parameter name: dueTime
> at System.Threading.Timer.Change(Int32 dueTime, Int32 period)
> at System.Timers.Timer.UpdateTimer()
> at System.Timers.Timer.set_Interval(Double value)
> at TimerProblem.Class1.Main(String[] args) in
> d:\awprojects\timerproblem\timerproblem\class1.cs:l
> ine 27
>
> I've even checked (with help from a colleaque) the system.dll and it seems
> to take in a float64 which is equivalent to double.
>
> Another value I've tried is
> 23759999999.0
>
> Can anyone please help in determining the solution (an idea is
> to manipulate the bits of the double)
>
> Thanks
>
>