Forum: Ruby-core [ruby-trunk - Bug #7868][Open] DateTime.now calculate negative timezone

Posted by omid.mt (Omid Mehdizadeh) (Guest)
on 2013-02-16 23:19
(Received via mailing list)
Issue #7868 has been reported by omid.mt (Omid Mehdizadeh).

----------------------------------------
Bug #7868: DateTime.now calculate negative timezone
https://bugs.ruby-lang.org/issues/7868

Author: omid.mt (Omid Mehdizadeh)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: ruby 1.9.3p374 (2013-01-15) [sparc-solaris2.10]


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.
Posted by ko1 (Koichi Sasada) (Guest)
on 2013-02-17 06:02
(Received via mailing list)
Issue #7868 has been updated by ko1 (Koichi Sasada).

Category set to lib
Assignee set to tadf (tadayoshi funaba)
Target version set to next minor

Funaba-san, could you check it?
----------------------------------------
Bug #7868: DateTime.now calculate negative timezone
https://bugs.ruby-lang.org/issues/7868#change-36366

Author: omid.mt (Omid Mehdizadeh)
Status: Open
Priority: Normal
Assignee: tadf (tadayoshi funaba)
Category: lib
Target version: next minor
ruby -v: ruby 1.9.3p374 (2013-01-15) [sparc-solaris2.10]


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.
Posted by omid.mt (Omid Mehdizadeh) (Guest)
on 2013-02-17 13:43
(Received via mailing list)
Issue #7868 has been updated by omid.mt (Omid Mehdizadeh).


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

"Looks like it's a Ruby bug in date_core.c - the HAVE_VAR_ALTZONE 
section should invert the timezone or altzone value as that's the code 
path taken by Solaris (tm.tm_gmtoff is BSD/GNU C Library extension and 
altzone is set by the Solaris tzset function)."
----------------------------------------
Bug #7868: DateTime.now calculate negative timezone
https://bugs.ruby-lang.org/issues/7868#change-36436

Author: omid.mt (Omid Mehdizadeh)
Status: Open
Priority: Normal
Assignee: tadf (tadayoshi funaba)
Category: lib
Target version: next minor
ruby -v: ruby 1.9.3p374 (2013-01-15) [sparc-solaris2.10]


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.
Posted by tadf (tadayoshi funaba) (Guest)
on 2013-02-17 17:41
(Received via mailing list)
Issue #7868 has been updated by tadf (tadayoshi funaba).

Status changed from Open to Feedback


----------------------------------------
Bug #7868: DateTime.now calculate negative timezone
https://bugs.ruby-lang.org/issues/7868#change-36447

Author: omid.mt (Omid Mehdizadeh)
Status: Feedback
Priority: Normal
Assignee: tadf (tadayoshi funaba)
Category: lib
Target version: next minor
ruby -v: ruby 1.9.3p374 (2013-01-15) [sparc-solaris2.10]


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.
Posted by tadf (tadayoshi funaba) (Guest)
on 2013-02-17 17:41
(Received via mailing list)
Issue #7868 has been updated by tadf (tadayoshi funaba).

File diff added

does this fix it?


----------------------------------------
Bug #7868: DateTime.now calculate negative timezone
https://bugs.ruby-lang.org/issues/7868#change-36446

Author: omid.mt (Omid Mehdizadeh)
Status: Open
Priority: Normal
Assignee: tadf (tadayoshi funaba)
Category: lib
Target version: next minor
ruby -v: ruby 1.9.3p374 (2013-01-15) [sparc-solaris2.10]


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.
Posted by omid.mt (Omid Mehdizadeh) (Guest)
on 2013-02-19 00:59
(Received via mailing list)
Issue #7868 has been updated by omid.mt (Omid Mehdizadeh).


Yes, It is OK now.

Thanks a lot.
----------------------------------------
Bug #7868: DateTime.now calculate negative timezone
https://bugs.ruby-lang.org/issues/7868#change-36579

Author: omid.mt (Omid Mehdizadeh)
Status: Feedback
Priority: Normal
Assignee: tadf (tadayoshi funaba)
Category: lib
Target version: next minor
ruby -v: ruby 1.9.3p374 (2013-01-15) [sparc-solaris2.10]


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.
Posted by nagachika (Tomoyuki Chikanaga) (Guest)
on 2013-02-24 15:12
(Received via mailing list)
Issue #7868 has been updated by nagachika (Tomoyuki Chikanaga).

Status changed from Open to Assigned
Assignee set to nagachika (Tomoyuki Chikanaga)


----------------------------------------
Backport #7868: DateTime.now calculate negative timezone
https://bugs.ruby-lang.org/issues/7868#change-36933

Author: omid.mt (Omid Mehdizadeh)
Status: Assigned
Priority: Normal
Assignee: nagachika (Tomoyuki Chikanaga)
Category:
Target version:


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.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.