Backport #7868

DateTime.now calculate negative timezone

Added by Omid Mehdizadeh about 1 year ago. Updated about 1 year ago.

[ruby-core:52303]
Status:Closed
Priority:Normal
Assignee:Usaku NAKAMURA

Description

I compiled 1.9.3-p374 on Solaris sparc. I found that the DateTime.now return time by wrong timezone in negative of what it should be. Time.now is OK.

irb(main):002:0> DateTime.now
DateTime.now
=> Sun, 17 Feb 2013 00:50:02 -0330

irb(main):006:0> Time.now
Time.now
=> 2013-02-17 00:28:07 +0330

irb(main):003:0> DateTime.now.zone
d.zone
=> "-03:30"

irb(main):004:0* DateTime.current
DateTime.current
=> Sat, 16 Feb 2013 21:20:28 +0000

This wrong timezone makes Time and DateTime comparison wrong.
As the implementation is in C now, couldn't figure out the logic.

diff Magnifier (407 Bytes) tadayoshi funaba, 02/18/2013 01:35 AM


Related issues

Duplicated by ruby-trunk - Bug #8226: incorrect timezone offset under Solaris 11 x64 Closed 04/06/2013

Associated revisions

Revision 40227
Added by Usaku NAKAMURA about 1 year ago

merge revision(s) 39475: [Backport #7868]

* ext/date/date_core.c: 

History

#1 Updated by Koichi Sasada about 1 year ago

  • Category set to lib
  • Assignee set to tadayoshi funaba
  • Target version set to next minor

Funaba-san, could you check it?

#2 Updated by Omid Mehdizadeh about 1 year ago

I got this info in rails community, that may help on catching the issue faster.

pixeltrix: "Looks like it's a Ruby bug in datecore.c - the HAVEVARALTZONE section should invert the timezone or altzone value as that's the code path taken by Solaris (tm.tmgmtoff is BSD/GNU C Library extension and altzone is set by the Solaris tzset function)."

#3 Updated by tadayoshi funaba about 1 year ago

does this fix it?

#4 Updated by tadayoshi funaba about 1 year ago

  • Status changed from Open to Feedback

#5 Updated by Omid Mehdizadeh about 1 year ago

Yes, It is OK now.

Thanks a lot.

#6 Updated by tadayoshi funaba about 1 year ago

  • Tracker changed from Bug to Backport
  • Project changed from ruby-trunk to Backport93
  • Category deleted (lib)
  • Status changed from Feedback to Open
  • Assignee deleted (tadayoshi funaba)
  • Target version deleted (next minor)

r39475

#7 Updated by Tomoyuki Chikanaga about 1 year ago

  • Status changed from Open to Assigned
  • Assignee set to Tomoyuki Chikanaga

#8 Updated by Tomoyuki Chikanaga about 1 year ago

  • Project changed from Backport93 to Backport200

#9 Updated by Tomoyuki Chikanaga about 1 year ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r39676.
Omid, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 39475: [Backport #7868]

* ext/date/date_core.c: 

#10 Updated by Usaku NAKAMURA about 1 year ago

  • Project changed from Backport200 to Backport93
  • Status changed from Closed to Assigned
  • Assignee changed from Tomoyuki Chikanaga to Usaku NAKAMURA

#11 Updated by Usaku NAKAMURA about 1 year ago

  • Status changed from Assigned to Closed

This issue was solved with changeset r40227.
Omid, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 39475: [Backport #7868]

* ext/date/date_core.c: 

Also available in: Atom PDF