IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30278


Ignore:
Timestamp:
Jan 14, 2011, 2:17:42 PM (15 years ago)
Author:
watersc1
Message:

backport with correct daytime calculation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tags/ipp-20101215/ippScripts/scripts/register_imfile.pl

    r30276 r30278  
    1010my $date = `date`;
    1111print "\n\n";
    12 print "Starting script $0 on $host at $date\n\n";
     12my $cmd_line = join ' ', @ARGV;
     13print "Starting script $0 $cmd_line on $host at $date\n\n";
    1314
    1415use vars qw( $VERSION );
     
    399400        $second =~ s/Z//;
    400401    }
    401     if (($hour >= $ss_hour)&&($minute >= $ss_minute)&&($second >= $ss_second)) {
    402         if (($hour <= $sr_hour)&&($minute <= $sr_minute)&&($second <= $sr_second)) {
    403             return(1);
     402#     print "this exposure: $hour $minute $second\n";
     403#     print "sunset:        $ss_hour $ss_minute $ss_second\n";
     404#     print "sunrise:       $sr_hour $sr_minute $sr_second\n";
     405#     printf "Hss: %d Mss: %d Sss: %d\n",($hour >= $ss_hour),($minute >= $ss_minute),($second >= $ss_second);
     406#     printf "Hsr: %d Msr: %d Ssr: %d\n",($hour <= $sr_hour),($minute <= $sr_minute),($second <= $sr_second);
     407
     408    if (($hour > $ss_hour)&&($hour <= 24)) {
     409        return(1); # After sunset by more than an hour, before midnight
     410    }
     411    elsif ($hour == $ss_hour) {
     412        if ($minute > $ss_minute) {
     413            return(1); # After sunset by more than a minute
    404414        }
    405     }
    406    
    407     return(0);
     415        elsif ($minute == $ss_minute) {
     416            if ($second >= $ss_second) {
     417                return(1); # After sunset by more than a second
     418            }
     419            else {
     420                return(0);
     421            }
     422        }
     423        else {
     424            return(0);
     425        }
     426    }
     427    elsif (($hour < $sr_hour)&&($hour >= 0)) {
     428        return(1); # Before sunrise by more than an hour, but after midnight
     429    }
     430    elsif ($hour == $sr_hour) {
     431        if ($minute < $sr_minute) {
     432            return(1); # Before sunrise by more than a minute
     433        }
     434        elsif ($minute == $sr_minute) {
     435            if ($second <= $sr_second) {
     436                return(1); # Before sunrise by more than a second
     437            }
     438            else {
     439                return(0);
     440            }
     441        }
     442        else {
     443            return(0);
     444        }
     445    }
     446    else {
     447        return(0); # We should never get here.
     448    }
    408449}
    409450
Note: See TracChangeset for help on using the changeset viewer.