IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 12, 2011, 1:08:55 PM (16 years ago)
Author:
watersc1
Message:

updates and bugfixes to registration. Will test this afternoon.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/register_imfile.pl

    r30217 r30240  
    3939
    4040my ($cache, $exp_id, $tmp_class_id, $tmp_exp_name, $uri, $bytes, $md5sum, $dbname, $verbose, $no_update, $no_op, $logfile);
     41my ($sunrise, $sunset);
    4142GetOptions(
    4243    'caches'           => \$cache,
     
    4748    'bytes=s'          => \$bytes,
    4849    'md5sum=s'         => \$md5sum,
     50    'sunrise=s'        => \$sunrise,
     51    'sunset=s'         => \$sunset,
    4952    'dbname|d=s'       => \$dbname,    # Database name
    5053    'verbose'          => \$verbose,   # Print to stdout
     
    6568    defined $uri;
    6669
     70unless (defined($sunset)) {
     71    $sunset = '03:30:00';
     72}
     73unless (defined($sunrise)) {
     74    $sunrise = '17:30:00';
     75}
    6776
    6877my $RECIPE = "REGISTER"; # Recipe to use for ppStats
     
    181190$command .= " -dbname $dbname" if defined $dbname;
    182191if (abs($burntoolStateCurrent) == $burntoolStateTarget) {
     192    $command .= " -data_state full";
     193}
     194elsif (is_daytime($dateobs,$sunset,$sunrise)) {
    183195    $command .= " -data_state full";
    184196}
     
    361373}
    362374
     375sub is_daytime
     376{
     377    my $dateobs = shift;
     378    my $sunset  = shift;
     379    my $sunrise = shift;
     380
     381    my $date,$time;
     382
     383    if ($dateobs =~ /T/) {
     384        ($date,$time) = split /T/, $dateobs;
     385    }
     386    else {
     387        ($date,$time) = split / /, $dateobs;
     388    }
     389    my ($hour,$minute,$second) = split /\:/, $time; # /;
     390    my ($ss_hour,$ss_minute,$ss_second) = split /\:/, $sunset; # /;
     391    my ($sr_hour,$sr_minute,$sr_second) = split /\:/, $sunrise; # /;
     392   
     393    if (($hour >= $ss_hour)&&($minute >= $ss_minute)&&($second >= $ss_second)) {
     394        if (($hour <= $sr_hour)&&($minute <= $sr_minute)&&($second <= $sr_second)) {
     395            return(1);
     396        }
     397    }
     398   
     399    return(0);
     400}
     401
    363402sub my_die_for_add
    364403{
Note: See TracChangeset for help on using the changeset viewer.