+ my $pkg = shift;
+ my $t = shift;
+ my ($year, $day) = (gmtime($t))[5,7];
+ $year += 1900;
+ return $pkg->SUPER::alloc($year, $day+1);
+}
+
+# take a julian date and subtract a number of days from it, returning the julian date
+sub sub($$)
+{
+ my ($old, $amount) = @_;
+ my $self = $old->copy;
+ my $diny = _isleap($self->[0]) ? 366 : 365;
+ $self->[1] -= $amount;
+ while ($self->[1] <= 0) {
+ $self->[1] += $diny;
+ $self->[0] -= 1;
+ $diny = _isleap($self->[0]) ? 366 : 365;
+ }
+ return $self;
+}
+
+sub add($$)
+{
+ 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;