Index: /trunk/psLib/test/astronomy/Makefile
===================================================================
--- /trunk/psLib/test/astronomy/Makefile	(revision 2176)
+++ /trunk/psLib/test/astronomy/Makefile	(revision 2177)
@@ -3,6 +3,6 @@
 ##  Makefile:   test/astronomy
 ##
-##  $Revision: 1.20 $  $Name: not supported by cvs2svn $
-##  $Date: 2004-10-15 19:10:51 $
+##  $Revision: 1.21 $  $Name: not supported by cvs2svn $
+##  $Date: 2004-10-20 20:02:46 $
 ##
 ##  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -21,4 +21,5 @@
 TARGET = tst_psTime_01 \
          tst_psTime_02 \
+         tst_psTime_03 \
          tst_psMetadataIO  \
          tst_psMetadata_01 \
Index: /trunk/psLib/test/astronomy/tst_psTime_02.c
===================================================================
--- /trunk/psLib/test/astronomy/tst_psTime_02.c	(revision 2176)
+++ /trunk/psLib/test/astronomy/tst_psTime_02.c	(revision 2177)
@@ -6,9 +6,10 @@
  *     A) Incorrect ISO time data
  *     B) Attempt to use null timeval
+ *     C) Free data
  *
  *  @author  Ross Harman, MHPCC
  *
- *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2004-10-12 01:34:09 $
+ *  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-10-20 20:02:46 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -34,12 +35,11 @@
 
     // Test B - Attempt to use null timeval
-    printNegativeTestHeader(stdout,"psTime", "Attempt to use null timeval",
-                            "Null value for timeval arg not allowed", 0);
+    printNegativeTestHeader(stdout,"psTime", "Attempt to use null timeval", "Null value for timeval arg not allowed", 0);
     psTimeFromTimeval(NULL);
     printFooter(stdout, "psTime", "Attempt to use null timeval", true);
 
 
-    // Test C - Free psMetadata
-    printPositiveTestHeader(stdout, "psMetadata", "Test C - Free psMetadata");
+    // Test C - Free data
+    printPositiveTestHeader(stdout, "psTime", "Test C - Free data");
     psMemCheckLeaks(0, NULL, stdout);
     psMemCheckCorruption(0);
@@ -48,5 +48,6 @@
         printf("ERROR: Found %d bad memory blocks\n", nBad);
     }
-    printFooter(stdout, "psMetadata", "Test C - Free psMetadata", true);
+    printFooter(stdout, "psTime", "Test C - Free data", true);
+
     return 0;
 }
Index: /trunk/psLib/test/astronomy/tst_psTime_03.c
===================================================================
--- /trunk/psLib/test/astronomy/tst_psTime_03.c	(revision 2177)
+++ /trunk/psLib/test/astronomy/tst_psTime_03.c	(revision 2177)
@@ -0,0 +1,143 @@
+
+/** @file  tst_psTime_03.c
+ *
+ *  @brief Test driver for psTime functions
+ *
+ *  This test driver contains the following tests for psTime:
+ *     Test A - Add two times
+ *     Test B - Subtact two times
+ *     Test C - Delta two times
+ *     Test D - Free data
+ *
+ *  @author  Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-10-20 20:03:10 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
+#include "pslib.h"
+#include "psTest.h"
+
+#define PRINT_TIME(TEXT,TIME) \
+printf("%s Seconds = %ld Microseconds = %u\n", TEXT, (long int)TIME->sec, TIME->usec);
+
+int main(int argc, char* argv[])
+{
+
+    // Test A - Add two times
+    printPositiveTestHeader(stdout, "psTime", "Test A - Add two times");
+    psTime *time1a   = NULL;
+    psTime *time1b   = NULL;
+    psTime *timeOut1 = NULL;
+    time1a = psTimeAlloc(PS_TIME_UTC);
+    time1b = psTimeAlloc(PS_TIME_UTC);
+    time1a->sec  = 1;
+    time1a->usec = 111111;
+    time1b->sec  = 1;
+    time1b->usec = 111111;
+    timeOut1 = psTimeAdd(time1a, time1b);
+    PRINT_TIME("Time 1:",time1a);
+    PRINT_TIME("Time 2:",time1b);
+    PRINT_TIME("Output Time:",timeOut1);
+    printFooter(stdout, "psTime", "Test A - Add two times", true);
+
+    // Test B - Add two times with overflow in microseconds
+    printPositiveTestHeader(stdout, "psTime", "Test B - Add two times with overflow in microseconds");
+    psTime *time2a   = NULL;
+    psTime *time2b   = NULL;
+    psTime *timeOut2 = NULL;
+    time2a = psTimeAlloc(PS_TIME_UTC);
+    time2b = psTimeAlloc(PS_TIME_UTC);
+    time2a->sec  = 6;
+    time2a->usec = 600001;
+    time2b->sec  = 5;
+    time2b->usec = 500001;
+    timeOut2 = psTimeAdd(time2a, time2b);
+    PRINT_TIME("Time 1:",time2a);
+    PRINT_TIME("Time 2:",time2b);
+    PRINT_TIME("Output Time:",timeOut2);
+    printFooter(stdout, "psTime", "Test B - Add two times with overflow in microseconds", true);
+
+
+    // Test C - Subtact two times
+    printPositiveTestHeader(stdout, "psTime", "Test C - Subtract two times");
+    psTime *time3a   = NULL;
+    psTime *time3b   = NULL;
+    psTime *timeOut3 = NULL;
+    time3a = psTimeAlloc(PS_TIME_UTC);
+    time3b = psTimeAlloc(PS_TIME_UTC);
+    time3a->sec  = 3;
+    time3a->usec = 333333;
+    time3b->sec  = 1;
+    time3b->usec = 111111;
+    timeOut3 = psTimeSubtract(time3a, time3b);
+    PRINT_TIME("Time 1:",time3a);
+    PRINT_TIME("Time 2:",time3b);
+    PRINT_TIME("Output Time:",timeOut3);
+    printFooter(stdout, "psTime", "Test C - Subtract two times", true);
+
+
+    // Test D - Subtact two times with underflow in microseconds
+    printPositiveTestHeader(stdout, "psTime", "Test D - Subtact two times with underflow in microseconds");
+    psTime *time4a   = NULL;
+    psTime *time4b   = NULL;
+    psTime *timeOut4 = NULL;
+    time4a = psTimeAlloc(PS_TIME_UTC);
+    time4b = psTimeAlloc(PS_TIME_UTC);
+    time4a->sec  = 5;
+    time4a->usec = 1;
+    time4b->sec  = 2;
+    time4b->usec = 3;
+    timeOut4 = psTimeSubtract(time4a, time4b);
+    PRINT_TIME("Time 1:",time4a);
+    PRINT_TIME("Time 2:",time4b);
+    PRINT_TIME("Output Time:",timeOut4);
+    printFooter(stdout, "psTime", "Test D - Subtact two times with underflow in microseconds", true);
+
+    // Test E - Delta two times
+    printPositiveTestHeader(stdout, "psTime", "Test E - Delta two times");
+    psTime *time5a   = NULL;
+    psTime *time5b   = NULL;
+    psTime *timeOut5 = NULL;
+    time5a = psTimeAlloc(PS_TIME_UTC);
+    time5b = psTimeAlloc(PS_TIME_UTC);
+    time5a->sec  = 2;
+    time5a->usec = 1;
+    time5b->sec  = 5;
+    time5b->usec = 3;
+    timeOut5 = psTimeDelta(time5a, time5b);
+    PRINT_TIME("Time 1:",time5a);
+    PRINT_TIME("Time 2:",time5b);
+    PRINT_TIME("Output Time:",timeOut5);
+    printFooter(stdout, "psTime", "Test E - Delta two times", true);
+
+
+    // Test D - Free data
+    printPositiveTestHeader(stdout, "psTime", "Test D - Free data");
+    psFree(time1a);
+    psFree(time1b);
+    psFree(timeOut1);
+    psFree(time2a);
+    psFree(time2b);
+    psFree(timeOut2);
+    psFree(time3a);
+    psFree(time3b);
+    psFree(timeOut3);
+    psFree(time4a);
+    psFree(time4b);
+    psFree(timeOut4);
+    psFree(time5a);
+    psFree(time5b);
+    psFree(timeOut5);
+    psMemCheckLeaks(0, NULL, stdout);
+    psMemCheckCorruption(0);
+    int nBad = psMemCheckCorruption(0);
+    if(nBad) {
+        printf("ERROR: Found %d bad memory blocks\n", nBad);
+    }
+    printFooter(stdout, "psTime", "Test D - Free data", true);
+    return 0;
+}
