Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zone incorrectly set in produced results #1

Open
vihai opened this issue Apr 9, 2013 · 1 comment
Open

Zone incorrectly set in produced results #1

vihai opened this issue Apr 9, 2013 · 1 comment

Comments

@vihai
Copy link

vihai commented Apr 9, 2013

Hi,

I think you are incorrectly setting the time zone of generated DateTimes:

SunRiseSet.today(45, 9).astroTwilightStart.to_s
=> "2013-04-09T05:04:16+00:00"

My time zone is +2:00 but the generated DateTime is in +0:00 however the time of twilight is local.

I changed to_datetime this way, I think it is more correct:

  def to_datetime(x,minutes)
    jd = DateTime.jd(@julian_day, 0, 0, 0, @zone)  + (minutes/1440.0)  + @zone 
  end

The result is:

[2] pry(main)> SunRiseSet.today(45, 9).astroTwilightStart.to_s
=> "2013-04-09T05:04:16+02:00"
@rbur004
Copy link
Owner

rbur004 commented Apr 15, 2013

I think there was a change in how zones behaved between Ruby versions. I
recall altering a similar bit of code after finding the Zone never got
added, when it had been doing so in the previous Ruby version.

I'll see if I can reproduce it, and find when the underlying Ruby
library changed its behaviour. Then I'll need to check which version is
being used.

On 10/04/13 3:50 AM, Daniele Orlandi wrote:

Hi,

I think you are incorrectly setting the time zone of generated DateTimes:

SunRiseSet.today(45, 9).astroTwilightStart.to_s
=> "2013-04-09T05:04:16+00:00"

My time zone is +2:00 but the generated DateTime is in +0:00 however
the time of twilight is /local/.

I changed to_datetime this way, I think it is more correct:

def to_datetime(x,minutes)
jd = DateTime.jd(@julian_day, 0, 0, 0, @zone) + (minutes/1440.0) + @zone
end

The result is:

[2] pry(main)> SunRiseSet.today(45, 9).astroTwilightStart.to_s
=> "2013-04-09T05:04:16+02:00"


Reply to this email directly or view it on GitHub
#1.

Rob Burrowes Ph: +64 9 923 2308 (Internal 82308)
Research Data Services Cell: +64 27 4731856 (internal 64209)
Technical Lead
Centre for eResearch
The University of Auckland
Private Bag 92019 http://www.sit.auckland.ac.nz/~rob
Auckland Mail Centre http://www.burrowes.org/
Auckland 1142 http://www.wikarekare.org/
NEW ZEALAND

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants