Unix system g77 calls DATE and TIME not working for Alpha/Linux 
Author Message
 Unix system g77 calls DATE and TIME not working for Alpha/Linux

I noticed that since g77 0.5.20, unix f77 system calls,
"call date" and "call time" silently have been working, which
means that they are not documented.  (Well,  we are not supposed to
expect an official g77 document till version 1.0 comes out.)

The syntax is:

      character chdate*9, chtime*8
c  Unix calls
      call date(chdate)
      call time(chtime)
      print*, chtime, chdate

Unfortunately, under Linux/Alpha, they don't seem to give the
correct date/time character strings.

Does anybody know more than what I know?  Why are they
not correct under Linux/Alpha?  Since day 1 with the Alpha
system, system clock has been the problem.....

Thanks a lot

-
G. Hugh Song

PS: Please remove "Spamspoiler" when replying



Wed, 18 Jun 1902 08:00:00 GMT  
 Unix system g77 calls DATE and TIME not working for Alpha/Linux

Quote:

>      character chdate*9, chtime*8
>c  Unix calls
>      call date(chdate)
>      call time(chtime)

>under Linux/Alpha, they don't seem to give the
>correct date/time character strings.
>system clock has been the problem

As these date and time functions aren't in any standard, it's not always
possible to say that they must work in any specific way.  For example, the
behavior of some ot these old non-standard functions is not defined portably as
of year 2000. Of course, if the C functions on which they are based are broken
or invoked incorrectly for your system, the results won't make any sense at
all.

The source code in libf2c is readily available for you to look at and suggest a
reasonable alternative for your system, preferably tied to an appropriate
#define which is already used in libf2c.  I would suggest you use fortran
standard functions such as DATE_AND_TIME (even though the g77 and VAX FORTRAN
only support the obvious non-keyworded subset of this function).

system_clock() is difficult to use properly.  One absolutely must allow for
roll over, especially on systems where g77 is returning the low order 32 bits
of a counter which has a much large number of bits on your system.  In such
(common) cases, the integer difference of two system_clock() values will make
sense even when the values roll over from positive to negative.  The maximum
interval may be doubled by appropriate adjustment, should the difference change
sign. On most sane systems, the roll over occurs less than once an hour, but
there's no guarantee.  Sometime, system_clock has been implemented with a
frequency of 1.00 hz, which errs on the other side of too infrequent roll
overs.  cpu_time is more appropriate in many contexts where people have used
system_clock, possibly because system_clock has a non-standard name on many
compiler systems.
Tim Prince



Wed, 18 Jun 1902 08:00:00 GMT  
 Unix system g77 calls DATE and TIME not working for Alpha/Linux

Quote:
> I noticed that since g77 0.5.20, unix f77 system calls,
> "call date" and "call time" silently have been working, which
> means that they are not documented.  (Well,  we are not supposed to
> expect an official g77 document till version 1.0 comes out.)

> The syntax is:

>       character chdate*9, chtime*8
> c  Unix calls
>       call date(chdate)
>       call time(chtime)
>       print*, chtime, chdate

> Unfortunately, under Linux/Alpha, they don't seem to give the
> correct date/time character strings.


        program test
      character chdate*9, chtime*8
c  Unix calls
      call date(chdate)
      call time(chtime)
      print*, chtime, chdate
      stop
        end

/a.out

 19:03:1118-Oct-98
Sun Oct 18 19:03:11 EDT 1998

Works great for me. If your system clock is wrong, I wouldn't be
surprised if g77 prints the same thing as the system clock. The answer
for configuring your overall Linux/Alpha system clock is in the
Linux/Alpha FAQ.

-- g



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. date and time calls in g77

2. arc does not work on Linux/Alpha?

3. dATE AND TIME PICKER ACTIVEX NOT WORKING

4. Unix time to calendar date/time?

5. Fortran + C on Alpha/Linux (g77+gcc) ?

6. SysFileTree corrupts change date/time on Alpha Server

7. exploratory system for unix system calls/facilities

8. Time and Date in g77 (f2c)

9. Date and Time using g77

10. g77: time, date, rnd ?

11. Create Time / date or Modified Time / date of a txt file

12. convert labview date/time to excel date/time

 

 
Powered by phpBB® Forum Software