2 # various julian date calculations
4 # Copyright (c) - 1998 Dirk Koopman G1TLH
15 my @days = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
17 # take a unix date and transform it into a julian day (ie (1998, 13) = 13th day of 1998)
21 my ($year, $day) = (gmtime($t))[5,7];
24 return ($year, $day+1);
27 # take a unix and return a julian month from it
31 my ($mon, $year) = (gmtime($t))[4..5];
34 return ($year, $mon + 1);
37 # take a julian date and subtract a number of days from it, returning the julian date
40 my ($year, $day, $amount) = @_;
41 my $diny = isleap($year) ? 366 : 365;
46 $diny = isleap($year) ? 366 : 365;
53 my ($year, $day, $amount) = @_;
54 my $diny = isleap($year) ? 366 : 365;
56 while ($day > $diny) {
59 $diny = isleap($year) ? 366 : 365;
64 # take a julian month and subtract a number of months from it, returning the julian month
67 my ($year, $mon, $amount) = @_;
78 my ($year, $mon, $amount) = @_;
89 my ($y1, $d1, $y2, $d2) = @_;
90 return $d1 - $d2 if ($y1 == $y2);
98 return ($year % 4 == 0 && ($year % 100 != 0 || $year % 400 == 0)) ? 1 : 0;