Index: /trunk/ippScripts/scripts/register_imfile.pl
===================================================================
--- /trunk/ippScripts/scripts/register_imfile.pl	(revision 30274)
+++ /trunk/ippScripts/scripts/register_imfile.pl	(revision 30275)
@@ -191,10 +191,13 @@
 $command .= " -dbname $dbname" if defined $dbname;
 if (abs($burntoolStateCurrent) == $burntoolStateTarget) {
+    printf STDERR "This has already been burned.\n";
     $command .= " -data_state full";
 }
 elsif (is_daytime($dateobs,$sunset,$sunrise)) {
+    printf STDERR "This is a daytime exposure.\n";
     $command .= " -data_state full";
 }
 else {
+    printf STDERR "Need to check burntool.\n";
     $command .= " -data_state check_burntool";
 }
@@ -257,5 +260,6 @@
 # We now have an imfile in the database, check if we can burntool it.  If not, continue on.
 
-if (abs($burntoolStateCurrent) != $burntoolStateTarget) {
+if ((abs($burntoolStateCurrent) != $burntoolStateTarget)&&
+    (!is_daytime($dateobs,$sunrise,$sunset))) {
     my $mdcParser  = PS::IPP::Metadata::Config->new;
 
@@ -268,5 +272,6 @@
     my $bt_check_command = "$regtool -checkburntoolimfile ";
     $bt_check_command .= " -class_id $class_id ";
-    $bt_check_command .= " -date $check_date ";
+    $bt_check_command .= " -dateobs_begin ${check_date}T${sunset} ";
+    $bt_check_command .= " -dateobs_end ${check_date}T${sunrise} ";
     $bt_check_command .= " -valid_burntool $burntoolStateTarget ";
     $bt_check_command .= " -exp_name $exp_name ";
@@ -391,5 +396,7 @@
     my ($ss_hour,$ss_minute,$ss_second) = split /\:/, $sunset; # /;
     my ($sr_hour,$sr_minute,$sr_second) = split /\:/, $sunrise; # /;
-    
+    if ($second =~ /Z/) {
+	$second =~ s/Z//;
+    }
     if (($hour >= $ss_hour)&&($minute >= $ss_minute)&&($second >= $ss_second)) {
 	if (($hour <= $sr_hour)&&($minute <= $sr_minute)&&($second <= $sr_second)) {
