develooper Front page | perl.datetime | Postings from January 2007

recurring system

Thread Next
From:
Matthew
Date:
January 16, 2007 12:18
Subject:
recurring system
Message ID:
45AD3313.7000502@matthewboehm.com
Hey guys,
   Does anyone have, already made, some type of "recurring events" 
module? We have our in-house function that works with singular weekly 
and singular monthly events but we'd like to branch into daily, 
bi-daily, bi-weekly, bi-monthly, every X weeks, every X days, etc.

Our current logic for calculating "the next event" for a weekly event is 
thus:

   Take the original time stamp of the event. Compare that to current 
time. If eventTimeStamp is greater than current time, return that 
date/time. Otherwise, add 1 week to eventTimeStamp and compare again. 
Loop until eventTimeStamp is greater than current time.

   To me, this seems amazingly inefficient. If my weekly recurring 
original event start date was Aug 1, 2006, the perl would have to loop 
26 times to find the next event (in this case, Jan 23).

Can anyone offer a better solution to this?

Thanks,
Matthew

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About