Revision: 1671
Author: eur.van.andel
Date: Thu Feb 18 02:22:05 2010
Log: modified calendar.jal to improve out-of-bounds conditions, like 255 for all hh:mm:ss

http://code.google.com/p/jallib/source/detail?r=1671

Modified:
 /trunk/include/jal/calendar.jal

=======================================
--- /trunk/include/jal/calendar.jal     Sat Nov 15 09:24:23 2008
+++ /trunk/include/jal/calendar.jal     Thu Feb 18 02:22:05 2010
@@ -22,10 +22,10 @@
       minutes = minutes + 1
    end loop

-   if minutes > 59 then
+   while minutes > 59 loop
minutes = minutes - 60 -- we assume calendar is called at least every 3 min
       hours = hours + 1
-   end if
+   end loop

    if hours > 23 then
       hours = 0
@@ -53,15 +53,21 @@
             end if
          end if
       end if
-
-      if date > max_date then
-         date = 1
-         month = month + 1
-         if month == 13 then
-            month = 1
-            year = year + 1
-         end if
-      end if
+   end if
+
+   if date > max_date ^ date == 0 then
+      date = 1
+      month = month + 1
    end if
+
+   if month >= 13 then
+      month = 1
+      year = year + 1
+   end if
+
+   if year > 2050 then
+      year = 2010             -- NASTY! ******************
+   end if
+
 end procedure

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to