Index: trunk/psLib/src/astro/psEarthOrientation.c
===================================================================
--- trunk/psLib/src/astro/psEarthOrientation.c	(revision 5626)
+++ trunk/psLib/src/astro/psEarthOrientation.c	(revision 5642)
@@ -8,6 +8,6 @@
  *  @author Robert Daniel DeSonia, MHPCC
  *
- *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-11-30 02:17:17 $
+ *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-11-30 23:50:40 $
  *
  *  Copyright 2005 Maui High Performance Computing Center, University of Hawaii
@@ -727,8 +727,9 @@
     }
     double T = (double)(in->sec) + (double)(in->nsec / 1e9);
-    printf("\nThe Value of T is = %.13g\n", T);
+    printf("\nThe Value of T is = %.19g\n", T);
     T += -2451545.0;
-    printf("\nThe Value of T is = %.13g\n", T);
     double theta = 2.0 * M_PI * (0.7790572732640 + 1.00273781191135448 * T);
+    printf("\nThe Value of theta is = %.13g\n", theta);
+    //    psSphereRot *out = psSphereRotInvert(theta, 0.0, 0.0);
     psSphereRot *out = psSphereRotInvert(theta, 0.0, 0.0);
 
@@ -745,8 +746,19 @@
     psSphere *in = NULL;
     double s;
+    psTime *time2 = psTimeAlloc(time->type);
+    time2->sec = time->sec;
+    time2->nsec = time->nsec;
+    time2->leapsecond = time->leapsecond;
+    //XXX:  Time must be converted to TAI before use?
+    if (time->type == PS_TIME_UT1) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "psTime cannot be of type UT1 here.\n");
+        return NULL;
+    } else if (time->type != PS_TIME_TAI) {
+        time2 = psTimeConvert(time2, PS_TIME_TAI);
+    }
 
     //XXX: This may be the wrong idea... ADD says to use 3rd-order polys to interpolate
     //polar motion coordinates.
-    in = p_psTimeGetPoleCoords(time);
+    in = p_psTimeGetPoleCoords(time2);
     if (in == NULL) {
         psError(PS_ERR_BAD_PARAMETER_NULL, true,
@@ -757,14 +769,14 @@
     out->y = in->d;
 
-    s = psTimeGetUT1Delta(time, bulletin);
+    s = psTimeGetUT1Delta(time2, bulletin);
     out->s = s;
 
     //XXX: Apply polar tide correction here???
-    psEarthPole *correction = psEOC_PolarTideCorr(time);
+    psEarthPole *correction = psEOC_PolarTideCorr(time2);
     out->x += correction->x;
     out->y += correction->y;
     out->s += correction->s;
 
-
+    psFree(time2);
     psFree(in);
     psFree(correction);
