Calculating U.S Federal holidays with Time::Moment


Time::Moment comes with Time::Moment::Adjusters which currently only provides…

Simple and efficient formatting of relative date/time using Time::Moment

#!/usr/bin/perl
use warnings;

use Carp              qw[];
use Time::Moment 0.19 qw[];

sub YEAR   () { 365.2425    }
sub MONTH  () { YEAR / 12   }
sub DAY    () { 1           }
sub HOUR   () { DAY / 24    }
sub MINUTE () { HOUR / 60   }
sub SECOND () { MINUTE / 60 }

sub ago {
    @_ == 1 or Carp::croak(q/Usage: ago(moment)/);
    my ($moment) = @_;

    my $now = Time::Moment->now;

    ($now->compare($moment) >= 0)
      or Carp::croak(q/Given moment is in the future/);

    my $d = $now->mjd - $moment->mjd;

    if ($d  0.75 * DAY) {
        if ($d…

Let's talk about Time::Moment and round-trip of strings

In my previous blog post I wrote a lot more about Time::Moment, than appeared in the post (could have been my mistake due to a preview and error and a incomplete copy and a paste, but still very inconvenient). So I have decided to break down my original blogpost in several blogposts.

Time::Moment implements a subset of ISO 8601 (known as 4.3 Date and time of day, 4.3.2 Complete representatio…

A bit more about Time::Moment

In my previous blog post I mentioned the bottlenecks of DateTime and why I had to develop Time::Moment and it's underlying c library, c-dt.

In this blog post I'll talk a bit of the design decisions I made for Time::Moment.

Time::Moment supports a finite set of timestamps, the range is 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z with nanosecond precision regardless …

Time::Moment vs DateTime

In December last year released the first version of Time::Moment. I don't foresee any major changes in Time::Moment 0.16 API, so in next release I'll remove the "early preview release" notice in the description. I have been using 0.16 in production two different deployments with great success, by removing DateTime from the ORM we have seen significantly reduced the memory usage and CPU usage and increased the throughput when inflating timestamps from a RDBM, previously DateTime was a one of …