× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



My problem is how to get duration of a certain part of the program.
It is my program and I'll put timestamping into it myself.

So idea is:

.....
time(&Time1) ;
processing...
processing...
processing...
time(&Time2) ;
Duration = GetTimeDifference(Time1, Time2) ;

But I know, that the processing takes surely less than a second, so time() 
function, returning seconds is not OK.

Looked at mattod(). It is said, that it's tick is 1/1000 sec. Fine. But isn't 
there somewhere a way to convert _MI_Time to something usable? Or if not, can 
anyone tell me, what are the arithmetical rules for _MI_Time - I need to 
subtract one from another?


I did some bit fiddling and finally got a piece, that seems to work, but it is 
really ugly:

mattod(Time1) ;                                                      
    mitime(&WaitTime, 0, 0, 0, 50) ;  /*hours,minutes,seconds,1/100*/
    waittime(&WaitTime, _WAIT_NORMAL) ;                              
mattod(Time2) ;                                                      
memcpy(Buf, &Time1, 8) ;                                             
memcpy(&Tim11, Buf, 4) ;                                             
memcpy(&TimShift, &Buf[4], 4) ;                                      
Tim12 = TimShift >> 22 ;                                             
memcpy(Buf, &Time2, 8) ;                                             
memcpy(&Tim21, Buf, 4) ;                                             
memcpy(&TimShift, &Buf[4], 4) ;                                      
Tim22 = TimShift >> 22 ;                                             
Diff = (Tim21 - Tim11) * 1000 + Tim22 - Tim12 ;                      
printf("Diff : %d ms\n", Diff) ;                                     

The idea of mitime and waittime is simply to compare printed result to 500ms 
delay.
Isn't it ugly?
Is it the only way?

TIA,

Jevgeni Astanovski


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.