IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 10, 2010, 9:59:34 AM (15 years ago)
Author:
rhenders
Message:

added getFullDate method to ass time section onto a date; fixed isBefore() method, which was faulty

File:
1 edited

Legend:

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

    r29686 r29741  
    6464    return $self->{_dbHost};                                                 
    6565}                                                                               
    66 ###########################################################################
    67 #
    68 # Adds the provided interval to the provided time
     66
     67###########################################################################
     68#
     69# Returns a date formatted wit hthe current formatting
    6970#
    7071###########################################################################
     
    8283###########################################################################
    8384#
     85# Returns a full MySQL formatted date
     86#
     87###########################################################################
     88sub getFullDate {
     89    my ($self, $time) = @_;
     90
     91    my $query = $self->{_db}->prepare(<<SQL);
     92    SELECT DATE_FORMAT('$time','%Y-%m-%d %H:%i:%s');
     93SQL
     94    $query->execute;
     95
     96    return scalar $query->fetchrow_array();
     97}
     98
     99###########################################################################
     100#
    84101# Adds the provided interval to the provided time
    85102#
     
    191208
    192209      my $query = $self->{_db}->prepare(<<SQL);
    193           SELECT '$time1' < '$time2';
    194 SQL
    195     $query->execute;
    196 
    197 return scalar $query->fetchrow_array();
     210          SELECT TIME_TO_SEC(TIMEDIFF('$time1', '$time2'));
     211SQL
     212    $query->execute;
     213
     214return (scalar $query->fetchrow_array() > 0) ? 0 : 1;
    198215}
    199216
Note: See TracChangeset for help on using the changeset viewer.