IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 31888


Ignore:
Timestamp:
Jul 15, 2011, 4:17:14 PM (15 years ago)
Author:
rhenders
Message:

added method to get time in the middle of two other times

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/czartool/MySQLDb.pm

    r29750 r31888  
    9999###########################################################################
    100100#
     101# Takes two times, time1 and time2 and finds the middle point
     102#
     103###########################################################################
     104sub getMiddleTime {
     105    my ($self, $time1, $time2) = @_;
     106
     107      my $query = $self->{_db}->prepare(<<SQL);
     108         SELECT '$time1' + INTERVAL (TIME_TO_SEC(TIMEDIFF('$time2', '$time1')) / 2) SECOND;
     109SQL
     110    $query->execute;
     111
     112return scalar $query->fetchrow_array();
     113}
     114
     115###########################################################################
     116#
    101117# Adds the provided interval to the provided time
    102118#
Note: See TracChangeset for help on using the changeset viewer.