views:

51

answers:

1

I have this at the top of my personal configuration file (as well as holidays, which are being respected, so I know the file is being read...):

WorkDayBeg = 08:00
WorkDayEnd = 17:00

... and yet when I do a delta on 08:00 to 17:00 in business mode, it says 8 hours instead of 9. It is defaulting to a work day of 09:00 to 17:00.

Any idea why?

+4  A: 

I do not observe that behavior:

#!/usr/bin/perl

use strict;
use warnings;

use Date::Manip;

Date_Init('WorkDayBeg = 08:00', 'WorkDayEnd = 17:00');

print 'Not in business mode: ',
    DateCalc(ParseDate('8:00'), ParseDate('17:00')), "\n",
    'In business mode: ',
    DateCalc(ParseDate('8:00'), ParseDate('17:00'), undef, 2), "\n";
C:\Temp> bun
Not in business mode: +0:0:0:0:9:0:0
In business mode: +0:0:0:1:0:0:0

As expected, the difference is nine hours if not in business mode and a working day if in business mode.

Sinan Ünür
You are absolutely right. I don't even want to admit what had me confused, but let's suffice it to say that my ensuing code converting the business days/hours into pure hours was where the problem lay. Thank you for the head check.
Marcus