Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsecond display in FORTRAN

Status
Not open for further replies.

shalinibasu82

Programmer
Mar 20, 2008
4
US
Hello,

Is there subroutine in FORTRAN to display time to the microsecond level? ( Crucial in performance evaluation )
There is this date_and_time function but it only displays to the milliseconds level.

Thanks.
Shalini.
 
This is an platform/compiler dependent question. Which platform/compiler are you using?
 
I have an Intel FORTRAN compiler running on 64 bit Linux. Anyway, somehow I couldn't find a FORTRAN subroutine to get microseconds.
So now I am calling C function from FORTRAN program.
Just for the benefit of others:

Inside FORTRAN
...
call SHOWTIME()
...


Inside C
#include<stdio.h>
#include<stdlib.h>
#include <sys/time.h>
#include <time.h>
void showtime_(void)
{
char buffer[30];
struct timeval tv;
time_t curtime;
gettimeofday(&tv, NULL);
curtime=tv.tv_sec;
strftime(buffer,30,"%m-%d-%Y %T.",localtime(&curtime));
printf("%s%ld\n",buffer,tv.tv_usec);
return 0;


}


SB.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top