Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site proper.UUCP Path: utzoo!linus!decvax!harpo!seismo!hao!hplabs!intelca!proper!shprentz From: shprentz@proper.UUCP (Joel Shprentz) Newsgroups: net.lang.f77 Subject: Re: Need help on date, time, errors msgs. Message-ID: <843@proper.UUCP> Date: Fri, 13-Jan-84 05:41:44 EST Article-I.D.: proper.843 Posted: Fri Jan 13 05:41:44 1984 Date-Received: Sun, 15-Jan-84 00:32:43 EST References: <122@wdl1.UUCP> Organization: Proper UNIX, San Leandro, CA Lines: 78 The following two C functions provide the time and date in F77 character string form. They appear similar to the time and date subroutines found on VAX VMS and CDC systems. Note that I am primarily a Fortran programmer trying to move an existing program to Unix with the minimum of fuss. I am sure their are better ways to write this, but, after all, what percent of total execution time is spent in the time and date subroutines? # Time subroutine for F77 programs # use: character*8 string # call time (string) # returns time string such as '12:34:56'. # strings less than 8 characters will be truncated. # strings longer than 8 characters will be padded with blanks. time_ (string, length) char *string; long int length; { char *ctime(), *ascii; int i; long clock, time(); /* get current time in ascii string. */ clock = time (0); ascii = ctime (&clock); /* move formatted time to user's string */ for (i=0; i<8 && i