Index: /trunk/psLib/src/astro/psTime.c
===================================================================
--- /trunk/psLib/src/astro/psTime.c	(revision 2748)
+++ /trunk/psLib/src/astro/psTime.c	(revision 2749)
@@ -10,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.48 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-12-17 02:22:02 $
+ *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-12-17 20:47:08 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -758,7 +758,6 @@
     PS_PTR_CHECK_NULL(time2,0);
     PS_INT_CHECK_RANGE(time1->usec,0,1e6-1,0);
-    PS_INT_CHECK_RANGE(time1->usec,0,1e6-1,0);
-
-    diff = abs(psTimeGetTAIDelta((psTime*)time1)-psTimeGetTAIDelta((psTime*)time2));
+    PS_INT_CHECK_RANGE(time2->usec,0,1e6-1,0);
+    diff = abs((psS64)psTimeGetTAIDelta((psTime*)time1)-(psS64)psTimeGetTAIDelta((psTime*)time2));
 
     return diff;
Index: /trunk/psLib/src/astronomy/psTime.c
===================================================================
--- /trunk/psLib/src/astronomy/psTime.c	(revision 2748)
+++ /trunk/psLib/src/astronomy/psTime.c	(revision 2749)
@@ -10,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.48 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-12-17 02:22:02 $
+ *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-12-17 20:47:08 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -758,7 +758,6 @@
     PS_PTR_CHECK_NULL(time2,0);
     PS_INT_CHECK_RANGE(time1->usec,0,1e6-1,0);
-    PS_INT_CHECK_RANGE(time1->usec,0,1e6-1,0);
-
-    diff = abs(psTimeGetTAIDelta((psTime*)time1)-psTimeGetTAIDelta((psTime*)time2));
+    PS_INT_CHECK_RANGE(time2->usec,0,1e6-1,0);
+    diff = abs((psS64)psTimeGetTAIDelta((psTime*)time1)-(psS64)psTimeGetTAIDelta((psTime*)time2));
 
     return diff;
Index: /trunk/psLib/test/astronomy/tst_psTime_03.c
===================================================================
--- /trunk/psLib/test/astronomy/tst_psTime_03.c	(revision 2748)
+++ /trunk/psLib/test/astronomy/tst_psTime_03.c	(revision 2749)
@@ -5,13 +5,19 @@
  *
  *  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
+ *
+ *   Test A - Add two times
+ *   Test B - Add two times with overflow in microseconds
+ *   Test C - Subtact two times
+ *   Test D - Subtact two times with underflow in microseconds
+ *   Test E - Delta two times
+ *   Test F - Delta two times with underflow in microseconds
+ *   Test G - Add two times across leapsecond boundary
+ *   Test H - Find number of leapseconds added between two times
+ *   Test G - Free data
  *
  *  @author  Ross Harman, MHPCC
  *
- *  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2004-12-16 18:53:28 $
+ *  @version $Revision: 1.7 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-12-17 20:48:47 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -138,6 +144,18 @@
 
 
+    // Test H - Find number of leapseconds added between two times
+    printPositiveTestHeader(stdout, "psTime", "Test H - Find number of leapseconds added between two times");
+    psS64 out = 0.0;
+    psTime *time8a = NULL;
+    psTime *time8b = NULL;
+    time8a = psTimeFromISOTime("2004-12-18T1:00:00.00");
+    time8b = psTimeFromISOTime("1972-1-1T1:00:00.00");
+    out = psTimeLeapseconds(time8a, time8b);
+    printf("%lld\n", out);
+    printFooter(stdout, "psTime", "Test H - Find number of leapseconds added between two times", true);
+
+
     // Test G - Free data
-    printPositiveTestHeader(stdout, "psTime", "Test G - Free data");
+    printPositiveTestHeader(stdout, "psTime", "Test I - Free data");
     psLibFinalize();
     psFree(time1a);
@@ -156,4 +174,6 @@
     psFree(time7a);
     psFree(timeOut7);
+    psFree(time8a);
+    psFree(time8b);
     if (psMemCheckLeaks(0, NULL, stdout,false)) {
         psError(PS_ERR_UNKNOWN,true,"Memory leaks detected.");
@@ -165,5 +185,5 @@
         printf("ERROR: Found %d bad memory blocks\n", nBad);
     }
-    printFooter(stdout, "psTime", "Test G - Free data", true);
+    printFooter(stdout, "psTime", "Test I - Free data", true);
     return 0;
 }
