Sha256: 5bd56944d8818264be2008c442446d468bc507822a9ef7de749afe458ddbcc7b

Contents?: true

Size: 439 Bytes

Versions: 1

Compression:

Stored size: 439 Bytes

Contents

class TimepieceController < ApplicationController

  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

1 entries across 1 versions & 1 rubygems

Version Path
timepiece-0.2.12 app/controllers/timepiece_controller.rb