+ my ($old, $amount) = @_;
+ my $self = $old->copy;
+ my $diny = _isleap($self->[0]) ? 366 : 365;
+ $self->[1] += $amount;
+ while ($self->[1] > $diny) {
+ $self->[1] -= $diny;
+ $self->[0] += 1;
+ $diny = _isleap($self->[0]) ? 366 : 365;
+ }
+ return $self;
+}
+
+sub as_string
+{
+ my $self = shift;
+ my $days = $self->[1];
+ my $mon = 0;
+ for (_isleap($self->[0]) ? @Julian::ldays : @Julian::days) {
+ if ($_ < $days) {
+ $days -= $_;
+ $mon++;
+ } else {
+ last;
+ }
+ }
+ return "$days-$Julian::month[$mon]-$self->[0]";
+}
+
+package Julian::Month;
+
+use vars qw(@ISA);
+@ISA = qw(Julian);
+
+sub new($$)
+{
+ my $pkg = shift;
+ my $t = shift;
+ my ($mon, $year) = (gmtime($t))[4,5];
+ $year += 1900;
+ return $pkg->SUPER::alloc($year, $mon+1);
+}
+
+# take a julian month and subtract a number of months from it, returning the julian month
+sub sub($$)
+{
+ my ($old, $amount) = @_;
+ my $self = $old->copy;
+
+ $self->[1] -= $amount;
+ while ($self->[1] <= 0) {
+ $self->[1] += 12;
+ $self->[0] -= 1;
+ }
+ return $self;