geonames DST problem

Discussion in 'Ruby' started by 12 34, Jun 3, 2010.

  1. 12 34

    12 34 Guest

    The script:

    #!/usr/bin/env ruby
    require 'rubygems'
    require 'geonames'

    lat=-54.936772
    lon=-67.604408

    timezone = Geonames::WebService.timezone lat, lon
    dst_offset = timezone.dst_offset.to_i # Is this for the day it's done?
    FIX to_i is not ROBUST
    gmt_offset = timezone.gmt_offset.to_i # not affected by DST
    timezone_id = timezone.timezone_id # Wordy version of timezone
    puts "timezone_id: #{timezone_id} \ngmt_offset: #{gmt_offset}
    \ndst_offset: #{dst_offset}"

    places_nearby = Geonames::WebService.find_nearby_place_name lat, lon
    location = "#{places_nearby.first.name},
    #{places_nearby.first.country_name}"

    puts "location: #{location}"

    # Result
    # timezone_id: America/Santiago
    # gmt_offset: -3
    # dst_offset: -4
    # location: Puerto Williams, Chile

    Am I mixed up or is the answer backwards?

    Here in California GMT-8 and DST is -7. Santiago should be on standard
    time now, not that that's relevant to what I think should be being
    delivered.
    --
    Posted via http://www.ruby-forum.com/.
     
    12 34, Jun 3, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. nag

    Handling of DST in java

    nag, Jan 10, 2006, in forum: Java
    Replies:
    26
    Views:
    14,760
    Yogendra Rishishwar
    Aug 6, 2010
  2. Big Jim

    Timezone/DST

    Big Jim, Apr 3, 2006, in forum: Java
    Replies:
    5
    Views:
    4,530
    Big Jim
    Apr 5, 2006
  3. js
    Replies:
    1
    Views:
    791
  4. Eric Frost
    Replies:
    0
    Views:
    230
    Eric Frost
    Feb 3, 2011
  5. 12 34

    Parsing geonames

    12 34, Jun 2, 2010, in forum: Ruby
    Replies:
    15
    Views:
    265
    Michael Fellinger
    Jun 5, 2010
Loading...

Share This Page