Index: trunk/psLib/src/astro/psCoord.c
===================================================================
--- trunk/psLib/src/astro/psCoord.c	(revision 3325)
+++ trunk/psLib/src/astro/psCoord.c	(revision 3332)
@@ -10,6 +10,6 @@
 *  @author GLG, MHPCC
 *
-*  @version $Revision: 1.53 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-02-25 02:49:00 $
+*  @version $Revision: 1.54 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-02-25 20:52:28 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -84,6 +84,4 @@
 }
 
-// XXX: Must test psSphereAlloc() and sphereFree().
-// XXX: Must rewrite code and tests to use these functions.
 psSphere* psSphereAlloc(void)
 {
@@ -352,13 +350,25 @@
 psSphereTransform* psSphereTransformEclipticToICRS(psTime *time)
 {
+    psF64 T;
+
+    // Check for null parameter
     PS_PTR_CHECK_NULL(time, NULL);
+
+    // Convert psTime to MJD
     psF64 MJD = psTimeToMJD(time);
-    struct tm *tmTime = psTimeToTM(time);
-    psF64 year = (psF64)(1900 - MJD + tmTime->tm_year);
-    psF64 T = year / 100.0;
+
+    // Check the specified MJD is greater than 1900
+    if ( MJD < MJD_1900 ) {
+        psError(PS_ERR_BAD_PARAMETER_TYPE,true,PS_ERRORTEXT_psCoord_INVALID_MJD);
+        return NULL;
+    }
+
+    // Calculate number of Julian centuries since 1900
+    T = ( MJD - MJD_1900 ) / JULIAN_CENTURY;
+
     psF64 alphaP = 0.0;
     psF64 deltaP = DEG_TO_RAD(23.0) +
-                   SEC_TO_RAD(27.0) +
-                   MIN_TO_RAD(8.0) -
+                   MIN_TO_RAD(27.0) +
+                   SEC_TO_RAD(8.26) -
                    (SEC_TO_RAD(46.845) * T) -
                    (SEC_TO_RAD(0.0059) * T * T) +
@@ -366,5 +376,4 @@
     psF64 phiP = 0.0;
 
-    psFree(tmTime);
     return (psSphereTransformAlloc(alphaP, deltaP, phiP));
 }
