Great respons as always, Brad. I should have consulted the documentation and tried to understand local myself. Now I see a vague reference to leap seconds in the brief description of in-timezone, but I’m not sure I would have understood it hadn’t you pointed it out to me.
And I wouldn’t have thought of subtracting to DateTime objects to get the difference in seconds. The documentation doesn’t indicate this in a way that was understandable to me, as the description of output was entirely different.
From the documentation:
say perl DateTime.new(:2016year) - DateTime.new(:2015year):; # OUTPUT: «Duration.new(31536001.0)␤»
I’m impressed by the work that’s gone into the documentation, but I have to admit that it’s often is surprisingly hard to understand, in particular when it comes to the finer points such as this. So what I’m perhaps really wondering where you guys pick up all of this :-)
As for the main subject of the article, I’m not able to see that your solution changes anything with regards to day length. I still get 86400:
$ perl6 -e 'my $a = Date.new("2018-03-25").DateTime.local; my $b = Date.new("2018-03-26").DateTime.local; say $b - $a; say $a; say $b;'86400
Again — it’s probably something I haven’t picked up on.
As for your answer I am, as always, very grateful that you took the time to share. I do, as I use to say, learn something new each time I blog about these things :-)