# File lib/flukso/database.rb, line 154 def find_last_reading(amount) if not amount.class==Fixnum raise "Must provide the number of last readings desired as an Fixnum." end stmt="SELECT * FROM \#{@tablename}\norder by epochtime DESC limit \#{amount};\n" #puts "Using statement #{stmt}" if $verbose readings=Array.new @db.execute(stmt) {|row| value=row['VALUE'].to_f; #timestamp=Time.at(row['EPOCHTIME'].to_f); timestamp=row['EPOCHTIME'].to_f; #puts "Creating new UTCReading: #{timestamp}, #{value}" reading=UTCReading.new(timestamp, value); readings << reading } if readings.empty? raise ElementNotFoundError end return readings; end