[svlug] Time - yy mm dd hh mm ss

dfox@belvdere.vip.best.com dfox at belvdere.vip.best.com
Sat May 27 23:00:51 PDT 2000


> If you want the source, check CPAN for the source of the Perl module I
> mentioned. I assume the souce for the "date" command Seth mentioned is
> available as part of the Linux source ... I'd guess the command is in the
> "base" of most major distributions.

Specifically /bin/date is part of the GNU shell utils (shutils), available
at your convenient gnu mirror.

As far as the Fortran -- memory is faulty here, but I seem to remember a
site called 'netlib' which had a large amount of fortran source. I got some
benchmark stuff from there years ago; stuff like livermore loops, whet-
stones, etc. I can't remember the exact ftp site name though.

> But in a Linux context, I assume Fortran has a facility for running external
> programs -- an equivalent to system() or backtics in newer languages. I'd

I think it does too - it's been a long time since I did much of any-
thing with fortran, and I'm not that familiar with the 77 variant(s).
On the other hand, you *can* link a routine written in C with Fortran,
meaning that you don't actually need to translate, per se, the source
you may already have. In fact, I did just that when I needed a time-
getting function, reproduced below: (Notice the function terminates
with an underline, needed to make the symbol visible from fortran.)


/*
 * SECOND: stolen from NEMO
 */

#include <stdio.h>

#if !defined(vms)

# include <sys/types.h>
# include <sys/times.h>

# if defined(unicos) || defined(cray)
#   include <sys/machd.h>
# else
#   include <sys/param.h>/* This might defined HZ - if not - set yourself */
			 /* define HZ to be the number of ticks/second */
			 /* Some places will have this defined as 50 or 100 */
			 /* Toshiba uses 100 - Cray has 1/60 ?? */
#endif

#else		/* special for Vomit Made System */
    struct tms {	/* VMS - not tested I believe (PJT) */
        int tms_utime, tms_stime, tms_cutime, tms_cstime;
    };
#endif

/* HZ is defined as a sysconf() call in Solaris */
#if !defined(HZ)	/* test if HZ defined ... */
# define HZ 60
#endif


float gettime_()
{
    struct tms buffer;

    if (times(&buffer) == -1) return -1.0;
    return buffer.tms_utime / (1.0*HZ); /* only in the USA */ 
}

> ------------------------------------"Never tell me the odds!"---
> Ray Olszewski                                        -- Han Solo
> Palo Alto, CA           	 	         ray at comarre.com        
> ----------------------------------------------------------------
 
------------------------------------------------------------------------
David E. Fox                     Census         Thanks for letting me
dfox at belvdere.vip.best.com        2000          change magnetic patterns
Be Counted: http://www.census.gov               on your hard disk.
-----------------------------------------------------------------------





More information about the svlug mailing list