Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
if i want to time an operation, can i format the result from the start time to the end time in seconds and fractions of a second, rather than just whole seconds?
-- Gary |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Sun, 12 Aug 2007 11:56:15 -0400, "Gary Keramidas" <GKeramidasATmsn.com
wrote: if i want to time an operation, can i format the result from the start time to the end time in seconds and fractions of a second, rather than just whole seconds? You could format your result as [s].000 --ron |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() thanks. don't know what i'm doing wrong, but when i set the start time to now, and the end time to now and then subtract, i get something like this: 8.10185156296939E-05 when i try to format the output like you suggested, i get zeroes. -- Gary "Ron Rosenfeld" wrote in message ... On Sun, 12 Aug 2007 11:56:15 -0400, "Gary Keramidas" <GKeramidasATmsn.com wrote: if i want to time an operation, can i format the result from the start time to the end time in seconds and fractions of a second, rather than just whole seconds? You could format your result as [s].000 --ron |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
if i want to time an operation, can i format the result from the start
time to the end time in seconds and fractions of a second, rather than just whole seconds? You could format your result as [s].000 thanks. don't know what i'm doing wrong, but when i set the start time to now, and the end time to now and then subtract, i get something like this: 8.10185156296939E-05 when i try to format the output like you suggested, i get zeroes. Well, the format that Ron gave you will only display 3 decimal places, the number you posted is 0.0000810185156296939 with the power of 10 part multiplied through, which, if you notice, has 4 zeroes after the decimal point. That number, rounded to 3 decimal places is 0. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
but it should display 3 or 4 seconds.
how do i get it so i can show how many seconds the routine runs? i have 3 different scenarios, i know which is faster, i'm just looking to time them. thanks -- Gary "Rick Rothstein (MVP - VB)" wrote in message ... if i want to time an operation, can i format the result from the start time to the end time in seconds and fractions of a second, rather than just whole seconds? You could format your result as [s].000 thanks. don't know what i'm doing wrong, but when i set the start time to now, and the end time to now and then subtract, i get something like this: 8.10185156296939E-05 when i try to format the output like you suggested, i get zeroes. Well, the format that Ron gave you will only display 3 decimal places, the number you posted is 0.0000810185156296939 with the power of 10 part multiplied through, which, if you notice, has 4 zeroes after the decimal point. That number, rounded to 3 decimal places is 0. Rick |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
i guess this is as close as i can get:
Second(endtime) - Second(starttime) -- Gary "Rick Rothstein (MVP - VB)" wrote in message ... if i want to time an operation, can i format the result from the start time to the end time in seconds and fractions of a second, rather than just whole seconds? You could format your result as [s].000 thanks. don't know what i'm doing wrong, but when i set the start time to now, and the end time to now and then subtract, i get something like this: 8.10185156296939E-05 when i try to format the output like you suggested, i get zeroes. Well, the format that Ron gave you will only display 3 decimal places, the number you posted is 0.0000810185156296939 with the power of 10 part multiplied through, which, if you notice, has 4 zeroes after the decimal point. That number, rounded to 3 decimal places is 0. Rick |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Your number 8.10185156296939E-05 most likely represents a fraction of a day.
Try multiplying it by 24*60*60 (# of secs in a day) before formatting or rounding to 3 dp I get 6.9999997 Tim "Gary Keramidas" <GKeramidasATmsn.com wrote in message ... but it should display 3 or 4 seconds. how do i get it so i can show how many seconds the routine runs? i have 3 different scenarios, i know which is faster, i'm just looking to time them. thanks -- Gary "Rick Rothstein (MVP - VB)" wrote in message ... if i want to time an operation, can i format the result from the start time to the end time in seconds and fractions of a second, rather than just whole seconds? You could format your result as [s].000 thanks. don't know what i'm doing wrong, but when i set the start time to now, and the end time to now and then subtract, i get something like this: 8.10185156296939E-05 when i try to format the output like you suggested, i get zeroes. Well, the format that Ron gave you will only display 3 decimal places, the number you posted is 0.0000810185156296939 with the power of 10 part multiplied through, which, if you notice, has 4 zeroes after the decimal point. That number, rounded to 3 decimal places is 0. Rick |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"Rick Rothstein (MVP - VB)" wrote in
message ... Well, the format that Ron gave you will only display 3 decimal places, the number you posted is 0.0000810185156296939 Or as a fraction of a day that's almost exactly 7 seconds ! dt = 0.0000810185156296939 MsgBox Format(dt, "s.000") & vbCr & _ Format(Format(dt, "s.000"), "[s].000") ' 7.000 & 7.000 Debug.Print dt * 24 * 60 * 60 ' 6.99999975040555 seconds Gary, if you're looking for accuracy of better than 0.5 seconds better to use an API Regards, Peter T |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
thanks, tim.
i was multiplying 1440*60, but didn't understand why i only got whole numbers when i show the results in the immediate window for the 3 routines, i get: 3.9999996778 6.9999997504 5.9999995166 when i was trying to format to 2 decimal places, i always just got the whole number why are the all .999999? -- Gary "Tim Williams" <timjwilliams at gmail dot com wrote in message ... Your number 8.10185156296939E-05 most likely represents a fraction of a day. Try multiplying it by 24*60*60 (# of secs in a day) before formatting or rounding to 3 dp I get 6.9999997 Tim "Gary Keramidas" <GKeramidasATmsn.com wrote in message ... but it should display 3 or 4 seconds. how do i get it so i can show how many seconds the routine runs? i have 3 different scenarios, i know which is faster, i'm just looking to time them. thanks -- Gary "Rick Rothstein (MVP - VB)" wrote in message ... if i want to time an operation, can i format the result from the start time to the end time in seconds and fractions of a second, rather than just whole seconds? You could format your result as [s].000 thanks. don't know what i'm doing wrong, but when i set the start time to now, and the end time to now and then subtract, i get something like this: 8.10185156296939E-05 when i try to format the output like you suggested, i get zeroes. Well, the format that Ron gave you will only display 3 decimal places, the number you posted is 0.0000810185156296939 with the power of 10 part multiplied through, which, if you notice, has 4 zeroes after the decimal point. That number, rounded to 3 decimal places is 0. Rick |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Sun, 12 Aug 2007 15:51:12 -0400, "Gary Keramidas" <GKeramidasATmsn.com
wrote: thanks. don't know what i'm doing wrong, but when i set the start time to now, and the end time to now and then subtract, i get something like this: 8.10185156296939E-05 when i try to format the output like you suggested, i get zeroes. When I format your value: 8.10185156296939E-05 as [s].000 I get 7.000 (seconds) That is precise to three decimal places, which is as good as you will get using a time format. If you want more precision than thousandths of a second is required (and that might be the case if you have very very accurate time determining techniques), then you should not be using Excel time format. Excel stores time as a fraction of a day. So 8.10185156296939E-05 is equal to 6.999999750405550 seconds. Rounded to thousandths of a second, it is 7.000 seconds. --ron |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
ok, thanks. that'll be good enough. i figured it was some excel limitation.
-- Gary "Ron Rosenfeld" wrote in message ... On Sun, 12 Aug 2007 15:51:12 -0400, "Gary Keramidas" <GKeramidasATmsn.com wrote: thanks. don't know what i'm doing wrong, but when i set the start time to now, and the end time to now and then subtract, i get something like this: 8.10185156296939E-05 when i try to format the output like you suggested, i get zeroes. When I format your value: 8.10185156296939E-05 as [s].000 I get 7.000 (seconds) That is precise to three decimal places, which is as good as you will get using a time format. If you want more precision than thousandths of a second is required (and that might be the case if you have very very accurate time determining techniques), then you should not be using Excel time format. Excel stores time as a fraction of a day. So 8.10185156296939E-05 is equal to 6.999999750405550 seconds. Rounded to thousandths of a second, it is 7.000 seconds. --ron |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
A question of time | New Users to Excel | |||
Time Question...is this possible? | Excel Discussion (Misc queries) | |||
Time Question | Excel Worksheet Functions | |||
Time question | Excel Programming | |||
Time Question | Excel Discussion (Misc queries) |