Class: EarthTools::Result::TimeZone

Inherits:
Base
  • Object
show all
Defined in:
lib/earth_tools/result/time_zone.rb

Overview

The Time Zone result.

Instance Attribute Summary

Attributes inherited from Base

#data

Instance Method Summary collapse

Methods inherited from Base

#initialize, #latitude, #location, #longitude, #version

Constructor Details

This class inherits a constructor from EarthTools::Result::Base

Instance Method Details

#dstString

Whether or not the #local_time and #iso_time is currently in DST. If they do, the value of this element will be ‘True’. If they do not, the value will be ‘False’. If it can’t be determined whether or not daylight saving time should be used, the value will be ‘Unknown’.

Returns:

  • (String)

    ‘True’ || ‘False’ || ‘Unknown’



14
15
16
# File 'lib/earth_tools/result/time_zone.rb', line 14

def dst
  @data['dst']
end

#dst?boolean

Whether or not the #local_time and #iso_time is currently in DST

Returns:

  • (boolean)

    true || false || nil



21
22
23
24
25
26
27
28
29
30
# File 'lib/earth_tools/result/time_zone.rb', line 21

def dst?
  case dst
  when 'True' then 
    true
  when 'False'
    false
  else
    nil
  end
end

#iso_timeString

The same value as #local_time but in ISO 8601 format instead See http://en.wikipedia.org/wiki/ISO_8601.

Returns:

  • (String)

    the ISO time



36
37
38
# File 'lib/earth_tools/result/time_zone.rb', line 36

def iso_time
  create_time @data['isotime']
end

#local_timeString

The local time taking into account the time zone offset and any local daylight saving time in effect

Returns:

  • (String)

    the local time



43
44
45
# File 'lib/earth_tools/result/time_zone.rb', line 43

def local_time
  iso_time
end

#suffixString

The nautical suffix for the time zone See http://en.wikipedia.org/wiki/Nautical_time

Returns:

  • (String)

    the nautical suffix for the time zone



59
60
61
# File 'lib/earth_tools/result/time_zone.rb', line 59

def suffix
  @data['suffix']
end

#utc_offsetInteger

The number of hours offset from UTC disregarding any correction for daylight saving time See http://en.wikipedia.org/wiki/UTC_offset.

Returns:

  • (Integer)

    the UTC offset



51
52
53
# File 'lib/earth_tools/result/time_zone.rb', line 51

def utc_offset
  @data['offset'].to_i
end

#utc_timeString

Returns:

  • (String)

    the UTC time



67
68
69
# File 'lib/earth_tools/result/time_zone.rb', line 67

def utc_time
  create_time @data['utctime'], "%Y-%m-%d %H:%M:%S"
end