hundreds of seconds?
Hi all How can I access partial seconds on the system clock? I measure air speed and water flow in a heat-exchanger test stand and count pulses from both water meter and air speed meter. I divide the amount of these counts over a certain interval with the time of that interval. Since I only have seconds, I need to wait 100 seconds for may calculation is I want a precision of 1%. The radiator fan that I use can't stand these long intervals, 'cause I run it with 24V and 50 Amps to get decent airflow (10m/s) through my heat exchanger. Again: how do I get the hundreds of seconds from the system clock? In Pascal it was: GetTime( Hr1, Min1, Sec1, cSec1); (yes, I'm that old). --- ir EE van Andel [EMAIL PROTECTED] www.fiwihex.nl Fiwihex B.V. Wierdensestraat 74, NL7604BK Almelo, Netherlands tel+31-546-491106 fax+31-546-491107 -- http://mail.python.org/mailman/listinfo/python-list
Re: hundreds of seconds?
[EMAIL PROTECTED] wrote: > Hi all > > How can I access partial seconds on the system clock? > > I measure air speed and water flow in a heat-exchanger test stand and > count pulses from both water meter and air speed meter. I divide the > amount of these counts over a certain interval with the time of that > interval. Since I only have seconds, I need to wait 100 seconds for may > calculation is I want a precision of 1%. > > The radiator fan that I use can't stand these long intervals, 'cause I > run it with 24V and 50 Amps to get decent airflow (10m/s) through my > heat exchanger. > > Again: how do I get the hundreds of seconds from the system clock? > > In Pascal it was: GetTime( Hr1, Min1, Sec1, cSec1); (yes, I'm that > old). time.time() returns the system time in seconds since the epoch (1970). The fractional part is relevant. However, be aware that your OS may limit the precision here. I'm not sure, but I think Windows for example doesn't get faster than 10th or 100th of a second. For more precise timing, you might need a special library/extension that works with the cpu timer register or something like that. Diez -- http://mail.python.org/mailman/listinfo/python-list
RE: hundreds of seconds?
> -Original Message- > From: [EMAIL PROTECTED] > How can I access partial seconds on the system clock? What is wrong with time.time()? >>> import time >>> time.time() 1160578386.0109401 >>> time.time() 1160578386.87324 >>> time.time() 1160578387.5790291 >>> x = time.time() >>> y = time.time() >>> z = y-x >>> z 4.6488111019134521 The difference between x and y is the number of seconds between 'polling's of the OS. There are some issues with precision. The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: hundreds of seconds?
[EMAIL PROTECTED] wrote: > > -Original Message- > > From: [EMAIL PROTECTED] > > > How can I access partial seconds on the system clock? > > What is wrong with time.time()? Absolutely nothing. > >>> import time > >>> time.time() > 1160578386.0109401 > >>> time.time() > 1160578386.87324 > >>> time.time() > 1160578387.5790291 > >>> x = time.time() > >>> y = time.time() > >>> z = y-x > >>> z > 4.6488111019134521 That was just what I needed. I was just ignorant, that's all. > The difference between x and y is the number of seconds between 'polling's of > the OS. There are some issues with precision. G5-fiwihex:~ eur$ python Python 2.3.5 (#1, Mar 20 2005, 20:38:20) [GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import time >>> time.time() 1160580871.258379 >>> My G5 has lots of digits behind the decimal point, my measuring PC runs W98. We'll see how it does there. But I trust it to be enough digits. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: hundreds of seconds?
[EMAIL PROTECTED] > ... > G5-fiwihex:~ eur$ python > Python 2.3.5 (#1, Mar 20 2005, 20:38:20) > [GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import time > >>> time.time() > 1160580871.258379 > >>> > > My G5 has lots of digits behind the decimal point, my measuring PC runs > W98. We'll see how it does there. But I trust it to be enough digits. On Windows 98, time.time() typically updates only once per 0.055 seconds (18.2 Hz), but time.clock() typically updates more than a million times per second. You do /not/ want to use time.time() for sub-second time measurement on Windows. Use time.clock() for this purpose on Windows. -- http://mail.python.org/mailman/listinfo/python-list
Re: hundreds of seconds?
"Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > However, be aware that your OS may limit the precision here. I'm not > sure, but I think Windows for example doesn't get faster than 10th or > 100th of a second. 1/100th of a second. > > For more precise timing, you might need a special library/extension > that works with the cpu timer register or something like that. Or in Windows case just call time.clock() instead. -- http://mail.python.org/mailman/listinfo/python-list
Re: hundreds of seconds?
Tim Peters wrote: > On Windows 98, time.time() typically updates only once per 0.055 > seconds (18.2 Hz), but time.clock() typically updates more than a > million times per second. You do /not/ want to use time.time() for > sub-second time measurement on Windows. Use time.clock() for this > purpose on Windows. Windows is not a real-time operating system. Let me say that again: Windows is not a real-time operating system. The times you get from those functions will not always be "the time I called the function". They will always be "some time between the time I called the function and it returned". The difference being, sometimes when you call a function it takes a lot longer to return because Windows has gone and done something else unrelated to your program for several seconds in-between. You can reduce how often this happens by jacking up the process priority for your program, but it never goes away completely, and, because Windows is not a real- time operating system, you can not predict with certainty when these delays will occur and how long they will be. Which may or may not matter, but people were talking about trusting the number of bits in a floating-point number to tell them the precision of the clock, so I figured I should clear up another misconception while they were learning not to do that, too... --Blair -- http://mail.python.org/mailman/listinfo/python-list
Re: hundreds of seconds?
python's time is as old as glibc's time(). A more clear interface as Java should be implements! though i'm not has the ability to do this. maybe some "volenties" could do out the favor. On Oct 11, 10:38 pm, [EMAIL PROTECTED] wrote: > Hi all > > How can I access partial seconds on the system clock? > > I measure air speed and water flow in a heat-exchanger test stand and > count pulses from both water meter and air speed meter. I divide the > amount of these counts over a certain interval with the time of that > interval. Since I only have seconds, I need to wait 100 seconds for may > calculation is I want a precision of 1%. > > The radiator fan that I use can't stand these long intervals, 'cause I > run it with 24V and 50 Amps to get decent airflow (10m/s) through my > heat exchanger. > > Again: how do I get the hundreds of seconds from the system clock? > > In Pascal it was: GetTime( Hr1, Min1, Sec1, cSec1); (yes, I'm that > old). > > --- > ir EE van Andel [EMAIL PROTECTED] > Fiwihex B.V. Wierdensestraat 74, NL7604BK Almelo, Netherlands > tel+31-546-491106 fax+31-546-491107 -- http://mail.python.org/mailman/listinfo/python-list