LCOV - code coverage report
Current view: top level - atnf/rpfits - datfit.f (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 25 0.0 %
Date: 2024-10-28 15:53:10 Functions: 0 1 0.0 %

          Line data    Source code
       1           0 :       SUBROUTINE DATFIT (OLDDAT, NEWDAT, IERR)
       2             : *-----------------------------------------------------------------------
       3             : * DATFIT translates a date from the old form, DD/MM/YY (or rarely
       4             : * DD/MM/YYYY), to the new form, YYYY-MM-DD, and also fixes some bad
       5             : * dates written at Mopra in 2000 with the year as '**'.
       6             : *
       7             : * Returns the current UTC date if the input date is blank (as used by
       8             : * RPFITSOUT).
       9             : *
      10             : *   Given:
      11             : *      OLDDAT   C**      Date in DD/MM/YY format.  If blank the current
      12             : *                        UTC date is supplied.
      13             : *
      14             : *   Returned:
      15             : *      NEWDAT   C*12     Date in YYYY-MM-DD form.
      16             : *
      17             : *      IERR     I        Error status:
      18             : *                           0: Success.
      19             : *                           1: Illegal OLDDAT.
      20             : *
      21             : *   Notes:
      22             : *      1) A date of the form DD/MM/YYYY is known to have been written
      23             : *         at least once at the ATCA on 18/11/1998 when the date format
      24             : *         was changed from DD/MM/YY to YYYY-MM-DD.
      25             : *
      26             : * $Id: datfit.f,v 1.10 2006/10/25 01:48:04 cal103 Exp $
      27             : *-----------------------------------------------------------------------
      28             :       INTEGER   IMON, IDAY, IYEAR, IERR
      29             :       CHARACTER INDATE*8, NEWDAT*12, OLDDAT*(*)
      30             : *-----------------------------------------------------------------------
      31           0 :       IF (LEN(OLDDAT).GE.8 .AND. OLDDAT.NE.' ') THEN
      32           0 :          IF (OLDDAT(3:3).NE.'/') THEN
      33             : *           New date format.
      34           0 :             NEWDAT = OLDDAT
      35           0 :             IERR = 0
      36           0 :             RETURN
      37             :          END IF
      38             : 
      39           0 :          IF (LEN(OLDDAT).GE.10) THEN
      40           0 :             IF (OLDDAT(7:8).EQ.'19' .AND. OLDDAT(9:10).NE.' ') THEN
      41             : *              Convert DD/MM/YYYY (rare) to DD/MM/YY.
      42           0 :                OLDDAT(7:) = OLDDAT(9:10)
      43             :             END IF
      44             :          END IF
      45             : 
      46             : *        Rescue bad dates written at Mopra in 2000.
      47           0 :          INDATE = OLDDAT
      48           0 :          IF (INDATE(7:8).EQ.'**') INDATE(7:8) = '00'
      49             : 
      50           0 :          READ (INDATE, '(I2,1X,I2,1X,I2)', IOSTAT=IERR) IDAY, IMON,
      51           0 :      :      IYEAR
      52           0 :          IF (IERR.NE.0) THEN
      53             : *           Bad date string.
      54           0 :             IERR = 1
      55           0 :             RETURN
      56             :          END IF
      57             : 
      58             :          IF (IMON.LT.1 .OR. IMON.GT.12 .OR.
      59           0 :      :       IDAY.LT.1 .OR. IDAY.GT.31) THEN
      60             : *           Invalid date fields.
      61           0 :             IERR = 1
      62           0 :             RETURN
      63             :          END IF
      64             : 
      65             : *        Years written at Mopra past 1999.
      66           0 :          IF (IYEAR.LT.70) IYEAR = IYEAR + 100
      67             : 
      68           0 :          IYEAR = 1900 + IYEAR
      69             : 
      70             :       ELSE
      71             : *        Get the current UTC date.
      72           0 :          CALL UTDATE (IYEAR, IMON, IDAY)
      73             :       END IF
      74             : 
      75           0 :       WRITE (NEWDAT, '(I4.4,2(A,I2.2))') IYEAR, '-', IMON, '-', IDAY
      76             : 
      77           0 :       RETURN
      78           0 :       END

Generated by: LCOV version 1.16