diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2005-11-01 05:53:29 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2005-11-01 05:53:29 +0000 |
commit | 53096259e6fb2000ca4bfd279e3f6b190d531090 (patch) | |
tree | f43ca2a90a1161ac81c75432afec4935809322c3 /libgfortran/intrinsics | |
parent | 4b2a5715eed5ff35731dc7eef78818fcd9aa4aa8 (diff) | |
download | gcc-53096259e6fb2000ca4bfd279e3f6b190d531090.zip gcc-53096259e6fb2000ca4bfd279e3f6b190d531090.tar.gz gcc-53096259e6fb2000ca4bfd279e3f6b190d531090.tar.bz2 |
re PR fortran/21565 (namelist in block data is illegal)
2005-11-01 Paul Thomas <pault@gcc.gnu.org>
PR fortran/21565
* symbol.c (check_conflict): An object cannot be in a namelist and in
block data.
PR fortran/18737
* resolve.c (resolve_symbol): Set the error flag to
gfc_set_default_type, in the case of an external symbol, so that
an error message is emitted if IMPLICIT NONE is set.
PR fortran/14994
* gfortran.h (gfc_generic_isym_id): Add GFC_ISYM_SECNDS to enum.
* check.c (gfc_check_secnds): New function.
* intrinsic.c (add_functions): Add call to secnds.
* iresolve.c (gfc_resolve_secnds): New function.
* trans-intrinsic (gfc_conv_intrinsic_function): Add call to
secnds via case GFC_ISYM_SECNDS.
* intrinsic.texi: Add documentation for secnds.
2005-11-01 Paul Thomas <pault@gcc.gnu.org>
PR fortran/14994
* libgfortran/intrinsics/date_and_time.c: Add interface to
the functions date_and_time for the intrinsic function secnds.
2005-11-01 Paul Thomas <pault@gcc.gnu.org>
PR fortran/21565
gfortran.dg/namelist_blockdata.f90: New test.
PR fortran/18737
gfortran.dg/external_implicit_none.f90: New test.
PR fortran/14994
* gfortran.dg/secnds.f: New test.
From-SVN: r106317
Diffstat (limited to 'libgfortran/intrinsics')
-rw-r--r-- | libgfortran/intrinsics/date_and_time.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/libgfortran/intrinsics/date_and_time.c b/libgfortran/intrinsics/date_and_time.c index be2959b..c52ccfe 100644 --- a/libgfortran/intrinsics/date_and_time.c +++ b/libgfortran/intrinsics/date_and_time.c @@ -305,3 +305,57 @@ date_and_time (char *__date, char *__time, char *__zone, fstrcpy (__date, DATE_LEN, date, DATE_LEN); } } + + +/* SECNDS (X) - Non-standard + + Description: Returns the system time of day, or elapsed time, as a GFC_REAL_4 + in seconds. + + Class: Non-elemental subroutine. + + Arguments: + + X must be REAL(4) and the result is of the same type. The accuracy is system + dependent. + + Usage: + + T = SECNDS (X) + + yields the time in elapsed seconds since X. If X is 0.0, T is the time in + seconds since midnight. Note that a time that spans midnight but is less than + 24hours will be calculated correctly. */ + +extern GFC_REAL_4 secnds (GFC_REAL_4 *); +export_proto(secnds); + +GFC_REAL_4 +secnds (GFC_REAL_4 *x) +{ + GFC_INTEGER_4 values[VALUES_SIZE]; + GFC_REAL_4 temp1, temp2; + + /* Make the INTEGER*4 array for passing to date_and_time. */ + gfc_array_i4 *avalues = internal_malloc_size (sizeof (gfc_array_i4)); + avalues->data = &values[0]; + GFC_DESCRIPTOR_DTYPE (avalues) = ((GFC_DTYPE_REAL << GFC_DTYPE_TYPE_SHIFT) + & GFC_DTYPE_TYPE_MASK) + + (4 << GFC_DTYPE_SIZE_SHIFT); + + avalues->dim[0].ubound = 7; + avalues->dim[0].lbound = 0; + avalues->dim[0].stride = 1; + + date_and_time (NULL, NULL, NULL, avalues, 0, 0, 0); + + free_mem (avalues); + + temp1 = 3600.0 * (GFC_REAL_4)values[4] + + 60.0 * (GFC_REAL_4)values[5] + + (GFC_REAL_4)values[6] + + 0.001 * (GFC_REAL_4)values[7]; + temp2 = fmod (*x, 86400.0); + temp2 = (temp1 - temp2 > 0.0) ? temp2 : (temp2 - 86400.0); + return temp1 - temp2; +} |