diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-03-04 21:21:30 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-03-04 21:21:30 -0500 |
commit | d54fe7c1f704a63824c5bfa0ece65245572e9b27 (patch) | |
tree | afc52015ffc2c74e0266653eecef1c8ef8ba5d91 /src/slalib/dtf2d.f | |
download | calfuse-d54fe7c1f704a63824c5bfa0ece65245572e9b27.tar.gz |
Initial commit
Diffstat (limited to 'src/slalib/dtf2d.f')
-rw-r--r-- | src/slalib/dtf2d.f | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/slalib/dtf2d.f b/src/slalib/dtf2d.f new file mode 100644 index 0000000..4a25ac6 --- /dev/null +++ b/src/slalib/dtf2d.f @@ -0,0 +1,55 @@ + SUBROUTINE sla_DTF2D (IHOUR, IMIN, SEC, DAYS, J) +*+ +* - - - - - - +* D T F 2 D +* - - - - - - +* +* Convert hours, minutes, seconds to days (double precision) +* +* Given: +* IHOUR int hours +* IMIN int minutes +* SEC dp seconds +* +* Returned: +* DAYS dp interval in days +* J int status: 0 = OK +* 1 = IHOUR outside range 0-23 +* 2 = IMIN outside range 0-59 +* 3 = SEC outside range 0-59.999... +* +* Notes: +* +* 1) The result is computed even if any of the range checks fail. +* +* 2) The sign must be dealt with outside this routine. +* +* P.T.Wallace Starlink July 1984 +* +* Copyright (C) 1995 Rutherford Appleton Laboratory +*- + + IMPLICIT NONE + + INTEGER IHOUR,IMIN + DOUBLE PRECISION SEC,DAYS + INTEGER J + +* Seconds per day + DOUBLE PRECISION D2S + PARAMETER (D2S=86400D0) + + + +* Preset status + J=0 + +* Validate sec, min, hour + IF (SEC.LT.0D0.OR.SEC.GE.60D0) J=3 + IF (IMIN.LT.0.OR.IMIN.GT.59) J=2 + IF (IHOUR.LT.0.OR.IHOUR.GT.23) J=1 + +* Compute interval + DAYS=(60D0*(60D0*DBLE(IHOUR)+DBLE(IMIN))+SEC)/D2S + + END |