Sha256: 9e5d148d02912375002db75445bfca2e4efd2fccecfdb91a200953ee1162847a

Contents?: true

Size: 486 Bytes

Versions: 3

Compression:

Stored size: 486 Bytes

Contents

class TimepieceController < ActionController::Base
  
  protect_from_forgery with: :null_session

  def clock
    arr = Array.new
    params[:timezones].each_with_index do | data, index |
    	zone = Time.now.in_time_zone(data)
      time = {
        :hours => zone.strftime('%H'),
        :minutes => zone.strftime('%M'),
        :seconds => zone.strftime('%S') 
      }
      arr << time
    end
    respond_to do |format|
      format.json { render :json => arr }
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
timepiece-0.4.1 app/controllers/timepiece_controller.rb
timepiece-0.4.0 app/controllers/timepiece_controller.rb
timepiece-0.3.0 app/controllers/timepiece_controller.rb