IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1385 for trunk/psLib/src/astro


Ignore:
Timestamp:
Aug 4, 2004, 1:37:39 PM (22 years ago)
Author:
desonia
Message:

found the server astyle upgrade was faulty, so the format was reset.

Location:
trunk/psLib/src/astro
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astro/psCoord.c

    r1374 r1385  
    1010*  @author George Gusciora, MHPCC
    1111*
    12 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-08-04 00:55:17 $
     12*  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-08-04 23:37:39 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3333{
    3434    if ( out == NULL ) {
    35             out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
    36         }
     35        out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
     36    }
    3737    out->x = transform->x->coeff[ 0 ][ 0 ] +
    3838             ( transform->x->coeff[ 1 ][ 0 ] * coords->x ) +
    3939             ( transform->x->coeff[ 0 ][ 1 ] * coords->y );
    40              
     40
    4141    out->y = transform->y->coeff[ 0 ][ 0 ] +
    4242             ( transform->y->coeff[ 1 ][ 0 ] * coords->x ) +
    4343             ( transform->y->coeff[ 0 ][ 1 ] * coords->y );
    44              
     44
    4545    return ( out );
    4646}
     
    5656{
    5757    if ( out == NULL ) {
    58             out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
    59         }
    60        
     58        out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
     59    }
     60
    6161    out->x = transform->x->coeff[ 0 ][ 0 ][ 0 ][ 0 ] +
    6262             ( transform->x->coeff[ 1 ][ 0 ][ 0 ][ 0 ] * coords->x ) +
     
    6464             ( transform->x->coeff[ 0 ][ 0 ][ 1 ][ 0 ] * term3 ) +
    6565             ( transform->x->coeff[ 0 ][ 0 ][ 0 ][ 1 ] * term4 );
    66              
     66
    6767    out->y = transform->y->coeff[ 0 ][ 0 ][ 0 ][ 0 ] +
    6868             ( transform->y->coeff[ 1 ][ 0 ][ 0 ][ 0 ] * coords->x ) +
     
    7070             ( transform->y->coeff[ 0 ][ 0 ][ 1 ][ 0 ] * term3 ) +
    7171             ( transform->y->coeff[ 0 ][ 0 ][ 0 ][ 1 ] * term4 );
    72              
     72
    7373    return ( out );
    7474}
     
    8181{
    8282    psSphereTransform * tmp = ( psSphereTransform * ) psAlloc( sizeof( psSphereTransform ) );
    83    
     83
    8484    tmp->sinPhi = sin( NPlat );
    8585    tmp->cosPhi = cos( NPlat );
    8686    tmp->Xo = Xo;
    8787    tmp->xo = xo;
    88    
     88
    8989    return ( tmp );
    9090}
     
    114114    double y = 0.0;
    115115    double dx = 0.0;
    116    
     116
    117117    if ( out == NULL ) {
    118             out = ( psSphere * ) psAlloc( sizeof( psSphere ) );
    119         }
    120        
     118        out = ( psSphere * ) psAlloc( sizeof( psSphere ) );
     119    }
     120
    121121    x = coord->r;
    122122    y = coord->d;
     
    127127           cos( y );
    128128    cosX = cos( y ) * cos( dx ) / cos( y );
    129    
     129
    130130    out->r = atan2( sinX, cosX ) + transform->Xo;
    131131    out->d = atan2( sinY, cosY );
    132    
     132
    133133    return ( out );
    134134}
     
    142142    double Xo = 0.0;
    143143    double xo = 0.0;
    144    
     144
    145145    return ( psSphereTransformAlloc( phi, Xo, xo ) );
    146146}
     
    154154    double Xo = 0.0;
    155155    double xo = 0.0;
    156    
     156
    157157    return ( psSphereTransformAlloc( phi, Xo, xo ) );
    158158}
     
    178178{
    179179    if ( x > 0 ) {
    180             return ( atan( y / x ) );
    181         } else if ( ( x == 0 ) && ( y == 0 ) ) {
     180        return ( atan( y / x ) );
     181    } else
     182        if ( ( x == 0 ) && ( y == 0 ) ) {
    182183            return ( 0.5 * M_PI );
    183         } else if ( ( x == 0 ) && ( y == 0 ) ) {
    184             return ( -0.5 * M_PI );
    185         } else if ( ( x == 0 ) && ( y == 0 ) ) {
    186             return ( M_PI + atan( y / x ) );
    187         } else if ( ( x == 0 ) && ( y == 0 ) ) {
    188             return ( -M_PI + atan( y / x ) );
    189         }
    190        
     184        } else
     185            if ( ( x == 0 ) && ( y == 0 ) ) {
     186                return ( -0.5 * M_PI );
     187            } else
     188                if ( ( x == 0 ) && ( y == 0 ) ) {
     189                    return ( M_PI + atan( y / x ) );
     190                } else
     191                    if ( ( x == 0 ) && ( y == 0 ) ) {
     192                        return ( -M_PI + atan( y / x ) );
     193                    }
     194
    191195    psAbort( __func__, "Unacceptable range for (arg(%f, %f).\n", x, y );
    192196    return ( 0.0 );
     
    201205    float alpha = 0.0;
    202206    psPlane *tmp = ( psPlane * ) psAlloc( sizeof( psPlane ) );
    203    
     207
    204208    if ( projection->type == PS_PROJ_TAN ) {
    205             R = cot( coord->r ) * ( 180.0 / M_PI );
    206             tmp->x = R * sin( coord->d );
    207             tmp->y = R * cos( coord->d );
    208            
    209         } else if ( projection->type == PS_PROJ_SIN ) {
     209        R = cot( coord->r ) * ( 180.0 / M_PI );
     210        tmp->x = R * sin( coord->d );
     211        tmp->y = R * cos( coord->d );
     212
     213    } else
     214        if ( projection->type == PS_PROJ_SIN ) {
    210215            R = cos( coord->r ) * ( 180.0 / M_PI );
    211216            tmp->x = R * sin( coord->d );
    212217            tmp->y = R * cos( coord->d );
    213            
    214         } else if ( projection->type == PS_PROJ_CAR ) {
    215             tmp->x = coord->d;
    216             tmp->y = coord->r;
    217            
    218         } else if ( projection->type == PS_PROJ_MER ) {
    219             tmp->x = coord->d;
    220             tmp->y = log( tan( 45.0 + ( 0.5 * coord->r ) ) ) * 180.0 / M_PI;
    221            
    222         } else if ( projection->type == PS_PROJ_AIT ) {
    223             alpha = 1.0 / ( ( 180.0 / M_PI ) *
    224                             sqrt( 1.0 + ( cos( coord->r ) * cos( 0.5 * coord->d ) * 0.5 ) ) );
    225                            
    226             tmp->x = 2.0 * alpha * cos( coord->r ) * sin( 0.5 * coord->d );
    227             tmp->y = alpha * sin( coord->d );
    228            
    229         } else if ( projection->type == PS_PROJ_PAR ) {
    230             psAbort( __func__, "The projection type PS_PROJ_PAR is undefined.\n" );
    231            
    232         } else if ( projection->type == PS_PROJ_GLS ) {
    233             psAbort( __func__, "The projection type PS_PROJ_GLS is undefined.\n" );
    234         }
    235        
     218
     219        } else
     220            if ( projection->type == PS_PROJ_CAR ) {
     221                tmp->x = coord->d;
     222                tmp->y = coord->r;
     223
     224            } else
     225                if ( projection->type == PS_PROJ_MER ) {
     226                    tmp->x = coord->d;
     227                    tmp->y = log( tan( 45.0 + ( 0.5 * coord->r ) ) ) * 180.0 / M_PI;
     228
     229                } else
     230                    if ( projection->type == PS_PROJ_AIT ) {
     231                        alpha = 1.0 / ( ( 180.0 / M_PI ) *
     232                                        sqrt( 1.0 + ( cos( coord->r ) * cos( 0.5 * coord->d ) * 0.5 ) ) );
     233
     234                        tmp->x = 2.0 * alpha * cos( coord->r ) * sin( 0.5 * coord->d );
     235                        tmp->y = alpha * sin( coord->d );
     236
     237                    } else
     238                        if ( projection->type == PS_PROJ_PAR ) {
     239                            psAbort( __func__, "The projection type PS_PROJ_PAR is undefined.\n" );
     240
     241                        } else
     242                            if ( projection->type == PS_PROJ_GLS ) {
     243                                psAbort( __func__, "The projection type PS_PROJ_GLS is undefined.\n" );
     244                            }
     245
    236246    return ( tmp );
    237247}
     
    247257    float chu2 = 0.0;
    248258    psSphere *tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) );
    249    
     259
    250260    if ( projection->type == PS_PROJ_TAN ) {
    251             R = sqrt( ( coord->x * coord->x ) + ( coord->y * coord->y ) );
    252             tmp->d = arg( -coord->y, coord->x );
    253             tmp->r = atan( 180.0 / ( R * M_PI ) );
    254            
    255         } else if ( projection->type == PS_PROJ_SIN ) {
     261        R = sqrt( ( coord->x * coord->x ) + ( coord->y * coord->y ) );
     262        tmp->d = arg( -coord->y, coord->x );
     263        tmp->r = atan( 180.0 / ( R * M_PI ) );
     264
     265    } else
     266        if ( projection->type == PS_PROJ_SIN ) {
    256267            R = sqrt( ( coord->x * coord->x ) + ( coord->y * coord->y ) );
    257268            tmp->d = arg( -coord->y, coord->x );
    258269            tmp->r = acos( ( R * M_PI ) / 180.0 );
    259            
    260         } else if ( projection->type == PS_PROJ_CAR ) {
    261             tmp->d = coord->x;
    262             tmp->r = coord->y;
    263            
    264         } else if ( projection->type == PS_PROJ_MER ) {
    265             tmp->d = coord->x;
    266             tmp->r = ( 2.0 * atan( exp( ( coord->y * M_PI / 180.0 ) ) ) ) - 180.0;
    267            
    268         } else if ( projection->type == PS_PROJ_AIT ) {
    269             chu1 = ( coord->x * M_PI ) / 720.0;
    270             chu1 *= chu1;
    271             chu2 = ( coord->y * M_PI ) / 360.0;
    272             chu2 *= chu2;
    273             chu = sqrt( 1.0 - chu1 - chu2 );
    274             tmp->d = 2.0 * arg( ( 2.0 * chu * chu ) - 1.0,
    275                                 ( coord->x * chu * M_PI ) / 360.0 );
    276             tmp->r = asin( ( coord->y * chu * M_PI ) / 180.0 );
    277            
    278         } else if ( projection->type == PS_PROJ_PAR ) {
    279             psAbort( __func__, "The projection type PS_PROJ_PAR is undefined.\n" );
    280            
    281         } else if ( projection->type == PS_PROJ_GLS ) {
    282             psAbort( __func__, "The projection type PS_PROJ_GLG is undefined.\n" );
    283         }
    284        
     270
     271        } else
     272            if ( projection->type == PS_PROJ_CAR ) {
     273                tmp->d = coord->x;
     274                tmp->r = coord->y;
     275
     276            } else
     277                if ( projection->type == PS_PROJ_MER ) {
     278                    tmp->d = coord->x;
     279                    tmp->r = ( 2.0 * atan( exp( ( coord->y * M_PI / 180.0 ) ) ) ) - 180.0;
     280
     281                } else
     282                    if ( projection->type == PS_PROJ_AIT ) {
     283                        chu1 = ( coord->x * M_PI ) / 720.0;
     284                        chu1 *= chu1;
     285                        chu2 = ( coord->y * M_PI ) / 360.0;
     286                        chu2 *= chu2;
     287                        chu = sqrt( 1.0 - chu1 - chu2 );
     288                        tmp->d = 2.0 * arg( ( 2.0 * chu * chu ) - 1.0,
     289                                            ( coord->x * chu * M_PI ) / 360.0 );
     290                        tmp->r = asin( ( coord->y * chu * M_PI ) / 180.0 );
     291
     292                    } else
     293                        if ( projection->type == PS_PROJ_PAR ) {
     294                            psAbort( __func__, "The projection type PS_PROJ_PAR is undefined.\n" );
     295
     296                        } else
     297                            if ( projection->type == PS_PROJ_GLS ) {
     298                                psAbort( __func__, "The projection type PS_PROJ_GLG is undefined.\n" );
     299                            }
     300
    285301    return ( tmp );
    286302}
     
    298314    double tmpR = 0.0;
    299315    double tmpD = 0.0;
    300    
     316
    301317    if ( mode == PS_LINEAR ) {
    302             // XXX: I have no idea how to construct this.  Maybe project both
    303             // sperical positions onto the plane, set the origin at one of the
    304             // points on the plane, then deproject?
    305            
    306             // XXX: Do I need to somehow scale this projection?
    307             // project position1?  Will it project to (0.0, 0.0)?
    308             proj.R = position1->r;
    309             proj.D = position1->d;
    310             proj.Xs = 1.0;
    311             proj.Ys = 1.0;
    312             proj.type = PS_PROJ_TAN;
    313            
    314             //        lin = psProject(position2, proj);
    315             //        tmp = psDeproject(lin, proj);
    316            
    317             // XXX: Do we need to convert units in tmp?
    318             return ( tmp );
    319         } else if ( mode == PS_SPHERICAL ) {
     318        // XXX: I have no idea how to construct this.  Maybe project both
     319        // sperical positions onto the plane, set the origin at one of the
     320        // points on the plane, then deproject?
     321
     322        // XXX: Do I need to somehow scale this projection?
     323        // project position1?  Will it project to (0.0, 0.0)?
     324        proj.R = position1->r;
     325        proj.D = position1->d;
     326        proj.Xs = 1.0;
     327        proj.Ys = 1.0;
     328        proj.type = PS_PROJ_TAN;
     329
     330        //        lin = psProject(position2, proj);
     331        //        tmp = psDeproject(lin, proj);
     332
     333        // XXX: Do we need to convert units in tmp?
     334        return ( tmp );
     335    } else
     336        if ( mode == PS_SPHERICAL ) {
    320337            tmpR = position2->r - position1->r;
    321338            tmpD = position2->d - position1->d;
    322            
     339
    323340            if ( unit == PS_ARCSEC ) {
    324                     tmpR = ( tmpR * 180.0 * 60.0 * 60.0 ) / M_PI;
    325                     tmpD = ( tmpR * 180.0 * 60.0 * 60.0 ) / M_PI;
    326                 } else if ( unit == PS_ARCMIN ) {
     341                tmpR = ( tmpR * 180.0 * 60.0 * 60.0 ) / M_PI;
     342                tmpD = ( tmpR * 180.0 * 60.0 * 60.0 ) / M_PI;
     343            } else
     344                if ( unit == PS_ARCMIN ) {
    327345                    tmpR = ( tmpR * 180.0 * 60.0 ) / M_PI;
    328346                    tmpD = ( tmpR * 180.0 * 60.0 ) / M_PI;
    329                 } else if ( unit == PS_DEGREE ) {
    330                     tmpR = ( tmpR * 180.0 ) / M_PI;
    331                     tmpD = ( tmpR * 180.0 ) / M_PI;
    332                 } else if ( unit == PS_RADIAN ) {}
    333             else {
    334                     psAbort( __func__, "Unknown offset unit: 0x%x\n", unit );
    335                 }
    336                
     347                } else
     348                    if ( unit == PS_DEGREE ) {
     349                        tmpR = ( tmpR * 180.0 ) / M_PI;
     350                        tmpD = ( tmpR * 180.0 ) / M_PI;
     351                    } else
     352                    if ( unit == PS_RADIAN ) {}
     353                        else {
     354                            psAbort( __func__, "Unknown offset unit: 0x%x\n", unit );
     355                        }
     356
    337357            tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) );
    338358            tmp->r = tmpR;
     
    361381    double tmpR = 0.0;
    362382    double tmpD = 0.0;
    363    
     383
    364384    if ( mode == PS_LINEAR ) {
    365             proj.R = position->r;
    366             proj.D = position->d;
    367             proj.Xs = 1.0;
    368             proj.Ys = 1.0;
    369             proj.type = PS_PROJ_TAN;
    370            
    371             lin.x = offset->r;
    372             lin.y = offset->d;
    373            
    374             tmp = psDeproject( &lin, &proj );
    375             return ( tmp );
    376            
    377         } else if ( mode == PS_SPHERICAL ) {
     385        proj.R = position->r;
     386        proj.D = position->d;
     387        proj.Xs = 1.0;
     388        proj.Ys = 1.0;
     389        proj.type = PS_PROJ_TAN;
     390
     391        lin.x = offset->r;
     392        lin.y = offset->d;
     393
     394        tmp = psDeproject( &lin, &proj );
     395        return ( tmp );
     396
     397    } else
     398        if ( mode == PS_SPHERICAL ) {
    378399            if ( unit == PS_ARCSEC ) {
    379                     tmpR = ( M_PI * offset->r ) / ( 180.0 * 60.0 * 60.0 );
    380                     tmpD = ( M_PI * offset->d ) / ( 180.0 * 60.0 * 60.0 );
    381                 } else if ( unit == PS_ARCMIN ) {
     400                tmpR = ( M_PI * offset->r ) / ( 180.0 * 60.0 * 60.0 );
     401                tmpD = ( M_PI * offset->d ) / ( 180.0 * 60.0 * 60.0 );
     402            } else
     403                if ( unit == PS_ARCMIN ) {
    382404                    tmpR = ( M_PI * offset->r ) / ( 180.0 * 60.0 );
    383405                    tmpD = ( M_PI * offset->d ) / ( 180.0 * 60.0 );
    384                 } else if ( unit == PS_DEGREE ) {
    385                     tmpR = ( M_PI * offset->r ) / ( 180.0 );
    386                     tmpD = ( M_PI * offset->d ) / ( 180.0 );
    387                 } else if ( unit == PS_RADIAN ) {
    388                     tmpR = offset->r;
    389                     tmpD = offset->d;
    390                 } else {
    391                     psAbort( __func__, "Unknown offset unit: 0x%x\n", unit );
    392                 }
    393                
     406                } else
     407                    if ( unit == PS_DEGREE ) {
     408                        tmpR = ( M_PI * offset->r ) / ( 180.0 );
     409                        tmpD = ( M_PI * offset->d ) / ( 180.0 );
     410                    } else
     411                        if ( unit == PS_RADIAN ) {
     412                            tmpR = offset->r;
     413                            tmpD = offset->d;
     414                        } else {
     415                            psAbort( __func__, "Unknown offset unit: 0x%x\n", unit );
     416                        }
     417
    394418            tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) );
    395419            tmp->r = position->r + tmpR;
     
    397421            tmp->rErr = 0.0;
    398422            tmp->dErr = 0.0;
    399            
     423
    400424            // XXX: wrap tmp->r and tmp->d to the allowed range (-PI to PI)
    401425            // and (0 to 2*PI).
  • trunk/psLib/src/astro/psCoord.h

    r1374 r1385  
    1010*  @author George Gusciora, MHPCC
    1111*
    12 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-08-04 00:55:17 $
     12*  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-08-04 23:37:39 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3030
    3131typedef struct
    32     {
    33         double x;      ///< x position
    34         double y;      ///< y position
    35         double xErr;   ///< Error in x position
    36         double yErr;   ///< Error in y position
    37     }
     32{
     33    double x;      ///< x position
     34    double y;      ///< y position
     35    double xErr;   ///< Error in x position
     36    double yErr;   ///< Error in y position
     37}
    3838psPlane;
    3939
    4040typedef struct
    41     {
    42         double r;      ///< RA
    43         double d;      ///< Dec
    44         double rErr;   ///< Error in RA
    45         double dErr;   ///< Error in Dec
    46     }
     41{
     42    double r;      ///< RA
     43    double d;      ///< Dec
     44    double rErr;   ///< Error in RA
     45    double dErr;   ///< Error in Dec
     46}
    4747psSphere;
    4848
    4949typedef struct
    50     {
    51         psDPolynomial2D *x;
    52         psDPolynomial2D *y;
    53     }
     50{
     51    psDPolynomial2D *x;
     52    psDPolynomial2D *y;
     53}
    5454psPlaneTransform;
    5555
    5656typedef struct
    57     {
    58         psDPolynomial4D *x;
    59         psDPolynomial4D *y;
    60     }
     57{
     58    psDPolynomial4D *x;
     59    psDPolynomial4D *y;
     60}
    6161psPlaneDistort;
    6262
    6363typedef struct
    64     {
    65         double sinPhi;                    ///< sin of North Pole lattitude
    66         double cosPhi;                    ///< cos of North Pole lattitude
    67         double Xo;                        ///< First PT of Ares lon
    68         double xo;                        ///< First PT of Ares equiv lon
    69     }
     64{
     65    double sinPhi;                    ///< sin of North Pole lattitude
     66    double cosPhi;                    ///< cos of North Pole lattitude
     67    double Xo;                        ///< First PT of Ares lon
     68    double xo;                        ///< First PT of Ares equiv lon
     69}
    7070psSphereTransform;
    7171
     
    8282
    8383typedef struct
    84     {
    85         double R;     ///< Coordinates of projection center
    86         double D;     ///< Coordinates of projection center
    87         double Xs;    ///< plate-scale in X direction
    88         double Ys;    ///< plate-scale in Y direction
    89         psProjectionType type;  ///< Projection type
    90     }
     84{
     85    double R;     ///< Coordinates of projection center
     86    double D;     ///< Coordinates of projection center
     87    double Xs;    ///< plate-scale in X direction
     88    double Ys;    ///< plate-scale in Y direction
     89    psProjectionType type;  ///< Projection type
     90}
    9191psProjection;
    9292
     
    106106                                const psPlaneTransform *transform,
    107107                                const psPlane *coords );
    108                                
     108
    109109psPlane *psPlaneDistortApply( psPlane *out,
    110110                              const psPlaneDistort *transform,
     
    112112                              float term3,
    113113                              float term4 );
    114                              
    115                              
     114
     115
    116116// New function prototype.
    117117psSphereTransform *psSphereTransformAlloc( double NPlat,
    118118        double Xo,
    119119        double xo );
    120        
     120
    121121void p_psSphereTransformFree( psSphereTransform *trans );
    122122
     
    124124                                  const psSphereTransform *transform,
    125125                                  const psSphere *coord );
    126                                  
     126
    127127psSphereTransform *psSphereTransformICRStoEcliptic( psTime time );
    128128psSphereTransform *psSphereTransformEcliptictoICRS( psTime time );
     
    132132psPlane *psProject( const psSphere *coord,
    133133                    const psProjection *projection );
    134                    
     134
    135135psSphere *psDeproject( const psPlane *coord,
    136136                       const psProjection *projection );
    137                        
     137
    138138psSphere *psSphereGetOffset( const psSphere *restrict position1,
    139139                             const psSphere *restrict position2,
    140140                             psSphereOffsetMode mode,
    141141                             psSphereOffsetUnit unit );
    142                              
     142
    143143psSphere *psSphereSetOffset( const psSphere *restrict position,
    144144                             const psSphere *restrict offset,
    145145                             psSphereOffsetMode mode,
    146146                             psSphereOffsetUnit unit );
    147                              
     147
    148148/// @}
    149149
  • trunk/psLib/src/astro/psTime.c

    r1272 r1385  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-07-22 21:24:54 $
     14 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-08-04 23:37:39 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    100100static double leapseconds[NUM_LEAPSECOND_UPDATES][2] =
    101101    {
    102         {2441317.5, 10.0},
    103         {2441499.5, 11.0},
    104         {2441683.5, 12.0},
    105         {2442048.5, 13.0},
    106         {2442413.5, 14.0},
    107         {2442778.5, 15.0},
    108         {2443144.5, 16.0},
    109         {2443509.5, 17.0},
    110         {2443874.5, 18.0},
    111         {2444239.5, 19.0},
    112         {2444786.5, 20.0},
    113         {2445151.5, 21.0},
    114         {2445516.5, 22.0},
    115         {2446247.5, 23.0},
    116         {2447161.5, 24.0},
    117         {2447892.5, 25.0},
    118         {2448257.5, 26.0},
    119         {2448804.5, 27.0},
    120         {2449169.5, 28.0},
    121         {2449534.5, 29.0},
    122         {2450083.5, 30.0},
    123         {2450630.5, 31.0},
    124         {2451179.5, 32.0}
     102        {
     103            2441317.5, 10.0
     104        },
     105        {
     106            2441499.5, 11.0
     107        },
     108        {
     109            2441683.5, 12.0
     110        },
     111        {
     112            2442048.5, 13.0
     113        },
     114        {
     115            2442413.5, 14.0
     116        },
     117        {
     118            2442778.5, 15.0
     119        },
     120        {
     121            2443144.5, 16.0
     122        },
     123        {
     124            2443509.5, 17.0
     125        },
     126        {
     127            2443874.5, 18.0
     128        },
     129        {
     130            2444239.5, 19.0
     131        },
     132        {
     133            2444786.5, 20.0
     134        },
     135        {
     136            2445151.5, 21.0
     137        },
     138        {
     139            2445516.5, 22.0
     140        },
     141        {
     142            2446247.5, 23.0
     143        },
     144        {
     145            2447161.5, 24.0
     146        },
     147        {
     148            2447892.5, 25.0
     149        },
     150        {
     151            2448257.5, 26.0
     152        },
     153        {
     154            2448804.5, 27.0
     155        },
     156        {
     157            2449169.5, 28.0
     158        },
     159        {
     160            2449534.5, 29.0
     161        },
     162        {
     163            2450083.5, 30.0
     164        },
     165        {
     166            2450630.5, 31.0
     167        },
     168        {
     169            2451179.5, 32.0
     170        }
    125171    };
    126172
     
    395441        psError(__func__,"Null value for timeval arg not allowed");
    396442        return outTime;
    397     } else if(time->tv_sec < 0)
    398     {
    399         psError(__func__,"Negative seconds are not allowed: %ld", time->tv_sec);
    400         return outTime;
    401     } else if(time->tv_usec<0)
    402     {
    403         psError(__func__,"Negative microseconds are not allowed: %ld", time->tv_usec);
    404         return outTime;
    405     }
     443    } else
     444        if(time->tv_sec < 0)
     445        {
     446            psError(__func__,"Negative seconds are not allowed: %ld", time->tv_sec);
     447            return outTime;
     448        } else
     449            if(time->tv_usec<0)
     450            {
     451                psError(__func__,"Negative microseconds are not allowed: %ld", time->tv_usec);
     452                return outTime;
     453            }
    406454
    407455    // Convert to psTime/TAI
     
    420468    int n;
    421469    int y;
    422     int mon [] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
     470    int mon [] =
     471        {
     472            31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
     473        };
    423474    long epoch;
    424475    psTime outTime;
     
    433484        psError(__func__,"Null value for tm arg not allowed");
    434485        return outTime;
    435     } else if(time->tm_year < 70)
    436     {
    437         psError(__func__,"Input times earlier than 1970 not allowed. Value: %d", time->tm_year+1900);
    438         return outTime;
    439     } else  if(time->tm_mon<0 || time->tm_mon>11)
    440     {
    441         psError(__func__,"Month must have a value from 0 to 11. Value: %d", time->tm_mon);
    442         return outTime;
    443     } else if(time->tm_mday<1 || time->tm_mday>31)
    444     {
    445         psError(__func__,"Day must have a value from 1 to 31. Value: %d", time->tm_mday);
    446         return outTime;
    447     } else if(time->tm_hour<0 || time->tm_hour>23)
    448     {
    449         psError(__func__,"Hour must have a value from 0 to 23. Value: %d", time->tm_hour);
    450         return outTime;
    451     } else if(time->tm_min<0 || time->tm_min>59)
    452     {
    453         psError(__func__,"Minute must have a value from 0 to 59. Value: %d", time->tm_min);
    454         return outTime;
    455     } else if(time->tm_sec<0 || time->tm_sec>59)
    456     {
    457         psError(__func__,"Second must have a value from 0 to 59. Value: %d", time->tm_sec);
    458         return outTime;
    459     }
     486    } else
     487        if(time->tm_year < 70)
     488        {
     489            psError(__func__,"Input times earlier than 1970 not allowed. Value: %d", time->tm_year+1900);
     490            return outTime;
     491        } else
     492            if(time->tm_mon<0 || time->tm_mon>11)
     493            {
     494                psError(__func__,"Month must have a value from 0 to 11. Value: %d", time->tm_mon);
     495                return outTime;
     496            } else
     497                if(time->tm_mday<1 || time->tm_mday>31)
     498                {
     499                    psError(__func__,"Day must have a value from 1 to 31. Value: %d", time->tm_mday);
     500                    return outTime;
     501                } else
     502                    if(time->tm_hour<0 || time->tm_hour>23)
     503                    {
     504                        psError(__func__,"Hour must have a value from 0 to 23. Value: %d", time->tm_hour);
     505                        return outTime;
     506                    } else
     507                        if(time->tm_min<0 || time->tm_min>59)
     508                        {
     509                            psError(__func__,"Minute must have a value from 0 to 59. Value: %d", time->tm_min);
     510                            return outTime;
     511                        } else
     512                            if(time->tm_sec<0 || time->tm_sec>59)
     513                            {
     514                                psError(__func__,"Second must have a value from 0 to 59. Value: %d", time->tm_sec);
     515                                return outTime;
     516                            }
    460517
    461518    n = time->tm_year + 1900 - 1;
  • trunk/psLib/src/astro/psTime.h

    r1256 r1385  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-07-22 01:03:00 $
     14 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-08-04 23:37:39 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Note: See TracChangeset for help on using the changeset viewer.