#!/usr/bin/env perl
# $Id: J2D.pl,v 1.5 2005/10/06 18:42:28 hiram Exp $
#
# J2D.pl - convert a julian date to a calendar date
#
# Arguments: must have one argument: the julian date to convert
use warnings;
use strict;
use CalDate; # subroutines: JulDate, CalDate, FormatCalDate
my $version = "2.4";
my $date = "2005-10-10 10:10:10 UTC - JD 2453653.923727";
my $jday_copyright = q(Copyright(C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 - jday at hiram.ws);
sub Version() {
printf("j2d - version %s - %s\n", $version, $date );
printf("\t%s\n", $jday_copyright );
}
sub Usage() {
printf("usage: J2D.pl <julian date>\n" );
&Version();
}
my $argc = $#ARGV + 1;
if( 1 != $argc ) {
&Usage();
die "ERROR: must supply a julian date\n";
}
if ( $ARGV[0] =~ /^-h.*/ ) {
&Usage();
die "\n";
}
if ( $ARGV[0] =~ /^-v.*/ ) {
&Version();
die "\n";
}
my %UTInstantNow;
$UTInstantNow{'J_DATE'} = $ARGV[0];
&CalDate(\%UTInstantNow);
my $D=&FormatCalDate(\%UTInstantNow);
printf("%s\n", $D);
syntax highlighted by Code2HTML, v. 0.9.1