Changeset 29436
- Timestamp:
- Oct 15, 2010, 12:34:14 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/tools/czartool/MySQLDb.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/czartool/MySQLDb.pm
r29376 r29436 98 98 ########################################################################### 99 99 # 100 # Finds the difference of two times 101 # 102 ########################################################################### 103 sub diffTimes { 104 my ($self, $time1, $time2) = @_; 105 106 my $query = $self->{_db}->prepare(<<SQL); 107 SELECT TIMEDIFF('$time1','$time2'); 108 SQL 109 110 $query->execute; 111 return scalar $query->fetchrow_array(); 112 } 113 114 ########################################################################### 115 # 116 # Finds the difference of two times in seconds 117 # 118 ########################################################################### 119 sub diffTimesInSecs { 120 my ($self, $time1, $time2) = @_; 121 122 my $query = $self->{_db}->prepare(<<SQL); 123 SELECT TIME_TO_SEC(TIMEDIFF('$time1','$time2')); 124 SQL 125 126 $query->execute; 127 return scalar $query->fetchrow_array(); 128 } 129 130 ########################################################################### 131 # 132 # Returns whether the first interval is larger than the second 133 # 134 ########################################################################### 135 sub isIntervalGreaterThan { 136 my ($self, $interval1, $interval2) = @_; 137 138 my $query = $self->{_db}->prepare(<<SQL); 139 SELECT INTERVAL('$interval1', '$interval2'); 140 SQL 141 $query->execute; 142 143 return scalar $query->fetchrow_array(); 144 } 145 146 ########################################################################### 147 # 100 148 # Subtracts the provided interval from the provided time 101 149 #
Note:
See TracChangeset
for help on using the changeset viewer.
