Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Midnight wraparound.by blue_cowdawg (Monsignor) |
on Aug 12, 2005 at 19:59 UTC ( [id://483385]=perlquestion: print w/replies, xml ) | Need Help?? |
blue_cowdawg has asked for the wisdom of the Perl Monks concerning the following question:
The problemOK... I'm feeling rather foolish right now, but I can't seem to figure out a good way to solve this seemingly simple problem.I have an application that is looking up values from a time schedule. Depending on when the lookup is run it is possible to wrap around from say 23:00 past midnight in the list of desired values. I want to keep the rows sorted by relative time with the wrapped around (does that term make sense?) rows kept as being chronologically after the pre midnight rows. I've come up with a brute force method, anymonk out there have an elegant way of doing this? The data is stored in a PostgreSQL database with a schema that looks sorta like this (confidential info has been obfuscated).
The application in one mode looks for events that happen within a window starting at an arbitrary time plus 3 hours and in the other mode looks for the next "n" events from an arbitrary time. These are daily scheduled events where the schedule might change every 3 months or so. The end application schedules other events to happen in lead of the events retrieved. IE if an event as happening at 23:10 the other event has to happen at 22:50 (30 minutes prior) and is used to schedule activities of some employees. Anybody have ideas?
Peter L. Berghold -- Unix Professional Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg
Back to
Seekers of Perl Wisdom
|
|