changeset 1021:4ebc7911ab98

[project @ 1995-01-10 23:19:42 by jwe]
author jwe
date Tue, 10 Jan 1995 23:20:48 +0000
parents 5dbaaa0b3d46
children d3790919922e
files scripts/miscellaneous/etime.m
diffstat 1 files changed, 18 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/miscellaneous/etime.m	Tue Jan 10 20:31:02 1995 +0000
+++ b/scripts/miscellaneous/etime.m	Tue Jan 10 23:20:48 1995 +0000
@@ -30,28 +30,31 @@
   endif
 
   if (is_vector (t1) && length (t1) == 6 && is_vector (t0) && length (t0) == 6)
-    error ("etime: args are not 6-element vectors");
-  endif
 
-  if (t1 (1) == t0 (1))
-    error ("etime: can't handle timings over year boundaries yet")
-  endif
+    if (t1 (1) != t0 (1))
+      error ("etime: can't handle timings over year boundaries yet")
+    endif
 
 # XXX FIXME XXX -- could check here to ensure that t1 and t0 really do
 # make sense as vectors returned from clock().
 
-  days_in_months = [31, 28, 31, 30, 31, 30 31, 31, 30, 31, 30, 31];
+    days_in_months = [31, 28, 31, 30, 31, 30 31, 31, 30, 31, 30, 31];
+
+    if (is_leap_year (t1 (1)))
+      days_in_months (2) = days_in_months (2) + 1;
+    endif
 
-  if (is_leap_year (t1 (1)))
-    days_in_months (2) = days_in_months (2) + 1;
+    d1 = sum (days_in_months (1:(t1 (2) - 1))) + t1 (3);
+    d0 = sum (days_in_months (1:(t0 (2) - 1))) + t0 (3);
+
+    s1 = 86400 * d1 + 3600 * t1 (4) + 60 * t1 (5) + t1 (6);
+    s0 = 86400 * d0 + 3600 * t0 (4) + 60 * t0 (5) + t0 (6);
+
+    secs = s1 - s0;
+
+  else
+    error ("etime: args are not 6-element vectors");
   endif
 
-  d1 = sum (days_in_months (1:(t1 (2) - 1))) + t1 (3);
-  d0 = sum (days_in_months (1:(t0 (2) - 1))) + t0 (3);
-
-  s1 = 86400 * d1 + 3600 * t1 (4) + 60 * t1 (5) + t1 (6);
-  s0 = 86400 * d0 + 3600 * t0 (4) + 60 * t0 (5) + t0 (6);
-
-  secs = s1 - s0;
 
 endfunction