Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > geonames DST problem

Reply
Thread Tools

geonames DST problem

 
 
12 34
Guest
Posts: n/a
 
      06-03-2010
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/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
New article on grabbing city points from geonames, processing withPython, and rendering in MapPoint Eric Frost Python 0 02-03-2011 06:10 PM
Handling of DST in java nag Java 26 08-06-2010 06:30 AM
Parsing geonames 12 34 Ruby 15 06-05-2010 06:31 AM
Timezone/DST Big Jim Java 5 04-05-2006 06:18 PM
PIX log reporting 169.254.126.114/500 dst outside:192.168.100.2/500 hoser Cisco 2 04-15-2005 05:22 PM



Advertisments