in reply to Re^4: efficient determination of in/out of hours
in thread efficient determination of in/out of hours including Bank Holidays
You either need a mktime that is time zone aware (POSIX::mktime seems to know about DST but not about time zones), or an UTC variant, e.g. Time::timegm. Of course, the logic of $today instead of time needs to be applied, anyway. (I tried it out, seems to work)
In the tests, the first date (from the future) kills too many holidays :-) (you should either sort the test data before the test, or create a new ooh() when time traveling)
Update: The easiest fix would have been (in the originally posted version):
my $today = POSIX::mktime(0,0,0,(localtime)[3..5]); while (<DATA>) { # read bank holiday file ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: efficient determination of in/out of hours
by Random_Walk (Prior) on Oct 18, 2013 at 13:09 UTC |