There's no overload that takes a float - just overloads that take int, int64, and uint32 and TimeSpan objects. Because there are multiple numeric types we can't pick which one is better to call - we lose precision either way. I would recommend:
timer = System.Threading.Timer(_callback, None, int(100.1), 0) # Throws exception From: [email protected] [mailto:[email protected]] On Behalf Of Idan Zaltzberg Sent: Saturday, December 19, 2009 10:20 PM To: [email protected] Subject: [IronPython] Timer constructor fails on float Hi, I recently encountered a problem when creating timers. It seems that creating a timer with a floating point interval or delay throws an exception: >>> def _callback(n): pass ... >>> timer = System.Threading.Timer(_callback, None, 100, 0) # Works fine >>> timer = System.Threading.Timer(_callback, None, 100.1, 0) # Throws exception Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: expected TimerCallback, got function How can I solve this? Thanks.
_______________________________________________ Users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
