# Geonames DST problem

**URL:** <https://rubytalk.org/t/geonames-dst-problem/58764>\
**Category:** ruby-talk\
**Created:** [3 June 2010 19:10 UTC](https://rubytalk.org/t/geonames-dst-problem/58764 "2010-06-03T19:10:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![12\_34](https://avatars.discourse-cdn.com/v4/letter/1/3d9bf3/32.png) [@12\_34](https://rubytalk.org/u/12_34)\
**Post date:** [3 June 2010 19:10 UTC](https://rubytalk.org/t/geonames-dst-problem/58764/1 "2010-06-03T19:10:12Z")

</div>

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/](http://www.ruby-forum.com/).
