Index: src/natools-cron.adb ================================================================== --- src/natools-cron.adb +++ src/natools-cron.adb @@ -1,7 +1,7 @@ ------------------------------------------------------------------------------ --- Copyright (c) 2014, Natacha Porté -- +-- Copyright (c) 2014-2015, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- @@ -150,13 +150,15 @@ use type Ada.Calendar.Time; Now : constant Ada.Calendar.Time := Ada.Calendar.Clock; Actual_Time : Periodic_Time := Time; begin - while Actual_Time.Origin < Now loop - Actual_Time.Origin := Actual_Time.Origin + Actual_Time.Period; - end loop; + if Actual_Time.Period > 0.0 then + while Actual_Time.Origin < Now loop + Actual_Time.Origin := Actual_Time.Origin + Actual_Time.Period; + end loop; + end if; if Map.Is_Empty then if Global_Worker /= null and then Global_Worker.all'Terminated then Unchecked_Free (Global_Worker); end if; @@ -256,11 +258,14 @@ if Entry_Maps.Element (Cursor) = Callback then declare Old_Time : constant Periodic_Time := Entry_Maps.Key (Cursor); begin Map.Delete (Cursor); - Insert (Old_Time, Callback); + + if Old_Time.Period > 0.0 then + Insert (Old_Time, Callback); + end if; end; exit Search; end if;