From: Neil C. <nc...@li...> - 2007-10-08 14:36:25
|
Gregg Liming wrote: > Quoting Neil Cherry (10/8/07 9:53 AM): >> Matthew Williams wrote: >>> Neil Cherry wrote: >>>> I'm looking for a portable way to get a time difference in ms. >>>> Do we have anyway to do that in MH? I know there are all sorts >>>> of calls for Linux to get to go as low nanoseconds but I need >>>> something portable so I can send some data and make sure that >>>> there is a long enough pause between that sent data and the >>>> next. Typically this is about 5ms/byte sent to the Insteon >>>> controllers. >>>> >>> I just thought of something. You may want to create a library of your own >>> to create a portable hires timer function. In POSIX systems, you would use >>> the Timer::HiRes stuff. In Windows systems, you could use the Win32::API to >>> access their timer stuff. Here's a web page about the timer interface: >>> >>> http://msdn2.microsoft.com/en-us/library/aa741304.aspx >>> >> Hehe, now your the trouble maker, making me eat my own words, >> touché! ;-). >> > > Will main::get_tickcount in lib/handy_utilities.pm not help? I'll take a look, thanks! :-) I added code to my code directory to print the print get_tickcount() for the first 10 times through the loop: # V 10/08/07 10:32:59 AM Tick = 1191853979992.26 10/08/07 10:33:00 AM Tick = 1191853980176.25 10/08/07 10:33:00 AM Tick = 1191853980272.18 10/08/07 10:33:00 AM Tick = 1191853980340.3 10/08/07 10:33:00 AM Tick = 1191853980400.13 10/08/07 10:33:00 AM Tick = 1191853980460.08 10/08/07 10:33:00 AM Tick = 1191853980524.13 10/08/07 10:33:00 AM Tick = 1191853980584.38 10/08/07 10:33:00 AM Tick = 1191853980648.12 10/08/07 10:33:00 AM Tick = 1191853980708.35 Yeah, that looks good! :-) Thanks -- Linux Home Automation Neil Cherry nc...@li... http://www.linuxha.com/ Main site http://linuxha.blogspot.com/ My HA Blog Author of: Linux Smart Homes For Dummies |