NigelH wrote:
>
> I'm trying to tune some macros, and I'd like to have start and end times
> more accurate than seconds. Is there any way I can access smaller times
> with QP9?
>
> (I've recently done a similar exercise with Excel/VB macros, and
> although it's a bit horrible I can produce timings down to 100ths of a
> second.)
A little bit of dabbling brings to light that (in v8, and apparently in v9 as
well), QP updates its internal timekeeper in 1-second increments. This in
effect prevents time accounting in QP at a level of precision below a second.
(Excel, it turns out, updates its time counter in increments of about 1 100th of
a second, which is why you're able to produce results to that level of
precision.)
A simple comparative test (both in QP and Excel) will illustrate what's
happening: Enter @NOW into a cell in a blank notebook, and format that cell as
a fixed number with 6 decimals. Now, press and hold F9. Observe how, in spite
of the rapid screen flickering, QP updates the displayed time value with a
noticeable delay -- at an interval which is not readily apparent but which turns
out to be 1 second. Performing the same test in Excel shows that the time value
there is seamlessly updated, without a delay.
A more refined test sheds further light on the actual update interval sizes
involved in both applications: In A1, enter the current system time as a value
(@NOW, F9, Enter). In A2, enter the current system time as a function (@NOW,
Enter). In A4, enter the formula
((A2-A1)*24*60-@INT((A2-A1)*24*60))*60
which produces the number of seconds (including FRACTIONAL seconds), above and
beyond (i.e., exclusive of) any minutes that have passed since the time value
recorded in A1. Format A4 as a number with 4 decimals. Now, press and hold F9.
Note how in QP the time value in A4 is updated at exactly 1-second intervals,
with fractional seconds completely dropped. (For the hyper-accountant, it
should be noted that there actually IS a fractional second included in the
result in A4, which becomes obvious if you change the format to more than 5
decimals; however, this fractional component is clearly due to rounding errors
introduced by the decimal conversion process of the two time systems as well as
problems related to binary vs. decimal arithmetic. The observed fractional
component is essentially range-bound between .999999 and .999998, and thus
represents a whole second in practical terms, rather than a significantly
variable quantity of 10ths or 100ths of a second.)
Again, performing the same test in Excel reveals that the time value there is
continually updated as you hold down F9. More importantly, one can easily
observe that not only is the number of whole seconds updated, but the first two
decimal places (representing 10ths and 100ths of a second) change continually as
well. The third decimal and beyond, however, remains unchanged at 0, and thus
represents the limit of Excel's time accounting capability. (Again, the same
caveat as above applies here with respect to a persistent, nearly constant
fractional component, which presents itself range-bound between 9997 and 9998
ten-thousandths of a second, representing 1 hundredth of a second for practical
purposes, and is simply due to internal rounding errors. Again, this only
becomes obvious if you expand the number of visible decimals to more than 5.)
Interestingly, this comparison has caused me to realize why in QP no provision
is made to custom-format time in units less than 1 second, because QP does not
bother to count time in smaller increments in the first place. On the other
hand, Excel does make provision for the display of sub-seconds as part of its
custom time formats, simply because it CAN count time in such small increments.
Thus, another interesting episode in the tug-of-war of features between QP and
Excel: Excel can count time in 1 100th of a second, but it can't handle time
before 1900. QP can only count time in 1-second intervals, but it can count
time as far back as 1600.
My, my ... all that ink spilled (and time spent) over such a trivial subject as
the span of time that's less than a second.
Befuddled and amused,
Uli
|