#include #include /******************************************************** The following ANSI C program provides the functionality of itime(3F) and idate(3F) for cases where the functions are missing in libraries. To avoid name collision, they have to be called by call as2idate(iarray) call as2itime(iarray) in the Fortran program. Mimic the idate(3F) library function: F77 syntax: subroutine as2idate(iarray) integer iarray(3) The return values in the iarray are: day of the month, month of the year (1-12) and 4-digit year. Mimic also the itime(3F) library function: F77 syntax: subroutine as2itime(iarray) integer iarray(3) The return values in the iarray are: hour , minute and second. The return value is the one in the *local* time zone as provided by the system. (See localtime(3c) for the interpretation) Richard J Mathar, 09/03/98 *************************************************************/ #ifdef __sun void as2idate_(int iarray[3]) #else void as2idate(int iarray[3]) #endif { struct tm* tmnow; time_t now; time(&now) ; tmnow=localtime(&now) ; iarray[0]=tmnow->tm_mday ; iarray[1]=tmnow->tm_mon +1 ; iarray[2]=tmnow->tm_year +1900 ; } #ifdef __sun void as2itime_(int iarray[3]) #else void as2itime(int iarray[3]) #endif { struct tm* tmnow; time_t now; time(&now) ; tmnow=localtime(&now) ; iarray[0]=tmnow->tm_hour ; iarray[1]=tmnow->tm_min ; iarray[2]=tmnow->tm_sec ; }