* [ruby-core:71089] [Ruby trunk - Bug #11595] [Open] Time#utc? and Time#gmt? return misleading results based on $TZ
[not found] <redmine.issue-11595.20151014193359@ruby-lang.org>
@ 2015-10-14 19:34 ` me
2015-11-30 13:24 ` [ruby-core:71753] [Ruby trunk - Bug #11595] " yasuhiro6194
` (4 subsequent siblings)
5 siblings, 0 replies; 6+ messages in thread
From: me @ 2015-10-14 19:34 UTC (permalink / raw)
To: ruby-core
Issue #11595 has been reported by David Celis.
----------------------------------------
Bug #11595: Time#utc? and Time#gmt? return misleading results based on $TZ
https://bugs.ruby-lang.org/issues/11595
* Author: David Celis
* Status: Open
* Priority: Normal
* Assignee:
* ruby -v: ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
There is an issue with Time#utc? and its alias, Time#gmt?, that return misleading results based on the value of the TZ environment variable. It seems that the only way for a Time instance to return `true` for `utc?` is if you explicitly call `#utc` on it before:
~~~
ENV['TZ'] = 'UTC'
# => "UTC"
time = Time.now
# => 2015-10-14 19:30:00 +0000
time.utc?
# => false
time = time.utc
# => 2015-10-14 19:30:00 UTC
time.utc?
# => true
~~~
This seems misleading based on the value of $TZ being "UTC". The expected result for calling `Time.now.utc?` in this case would be `true`, as would that be expected for time zones that are considered links to "UTC" based on the [tzdata list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). These include "UTC", "GMT", "Etc/UTC", "Etc/GMT", "Universal", etc.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* [ruby-core:71753] [Ruby trunk - Bug #11595] Time#utc? and Time#gmt? return misleading results based on $TZ
[not found] <redmine.issue-11595.20151014193359@ruby-lang.org>
2015-10-14 19:34 ` [ruby-core:71089] [Ruby trunk - Bug #11595] [Open] Time#utc? and Time#gmt? return misleading results based on $TZ me
@ 2015-11-30 13:24 ` yasuhiro6194
2015-11-30 13:27 ` [ruby-core:71754] " yasuhiro6194
` (3 subsequent siblings)
5 siblings, 0 replies; 6+ messages in thread
From: yasuhiro6194 @ 2015-11-30 13:24 UTC (permalink / raw)
To: ruby-core
Issue #11595 has been updated by Yasuhiro Nakamura.
Assignee set to Akira Tanaka
----------------------------------------
Bug #11595: Time#utc? and Time#gmt? return misleading results based on $TZ
https://bugs.ruby-lang.org/issues/11595#change-55165
* Author: David Celis
* Status: Open
* Priority: Normal
* Assignee: Akira Tanaka
* ruby -v: ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
There is an issue with Time#utc? and its alias, Time#gmt?, that return misleading results based on the value of the TZ environment variable. It seems that the only way for a Time instance to return `true` for `utc?` is if you explicitly call `#utc` on it before:
~~~
ENV['TZ'] = 'UTC'
# => "UTC"
time = Time.now
# => 2015-10-14 19:30:00 +0000
time.utc?
# => false
time = time.utc
# => 2015-10-14 19:30:00 UTC
time.utc?
# => true
~~~
This seems misleading based on the value of $TZ being "UTC". The expected result for calling `Time.now.utc?` in this case would be `true`, as would that be expected for time zones that are considered links to "UTC" based on the [tzdata list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). These include "UTC", "GMT", "Etc/UTC", "Etc/GMT", "Universal", etc.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* [ruby-core:71754] [Ruby trunk - Bug #11595] Time#utc? and Time#gmt? return misleading results based on $TZ
[not found] <redmine.issue-11595.20151014193359@ruby-lang.org>
2015-10-14 19:34 ` [ruby-core:71089] [Ruby trunk - Bug #11595] [Open] Time#utc? and Time#gmt? return misleading results based on $TZ me
2015-11-30 13:24 ` [ruby-core:71753] [Ruby trunk - Bug #11595] " yasuhiro6194
@ 2015-11-30 13:27 ` yasuhiro6194
2015-11-30 16:55 ` [ruby-core:71759] " me
` (2 subsequent siblings)
5 siblings, 0 replies; 6+ messages in thread
From: yasuhiro6194 @ 2015-11-30 13:27 UTC (permalink / raw)
To: ruby-core
Issue #11595 has been updated by Yasuhiro Nakamura.
File time_utc.patch added
Anyway I write a patch.
Is it a bug? or specification?
----------------------------------------
Bug #11595: Time#utc? and Time#gmt? return misleading results based on $TZ
https://bugs.ruby-lang.org/issues/11595#change-55166
* Author: David Celis
* Status: Open
* Priority: Normal
* Assignee: Akira Tanaka
* ruby -v: ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
There is an issue with Time#utc? and its alias, Time#gmt?, that return misleading results based on the value of the TZ environment variable. It seems that the only way for a Time instance to return `true` for `utc?` is if you explicitly call `#utc` on it before:
~~~
ENV['TZ'] = 'UTC'
# => "UTC"
time = Time.now
# => 2015-10-14 19:30:00 +0000
time.utc?
# => false
time = time.utc
# => 2015-10-14 19:30:00 UTC
time.utc?
# => true
~~~
This seems misleading based on the value of $TZ being "UTC". The expected result for calling `Time.now.utc?` in this case would be `true`, as would that be expected for time zones that are considered links to "UTC" based on the [tzdata list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). These include "UTC", "GMT", "Etc/UTC", "Etc/GMT", "Universal", etc.
---Files--------------------------------
time_utc.patch (927 Bytes)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* [ruby-core:71759] [Ruby trunk - Bug #11595] Time#utc? and Time#gmt? return misleading results based on $TZ
[not found] <redmine.issue-11595.20151014193359@ruby-lang.org>
` (2 preceding siblings ...)
2015-11-30 13:27 ` [ruby-core:71754] " yasuhiro6194
@ 2015-11-30 16:55 ` me
2016-01-23 18:55 ` [ruby-core:73320] " andrew
2016-11-05 16:09 ` [ruby-core:77990] [Ruby trunk Bug#11595][Rejected] " akr
5 siblings, 0 replies; 6+ messages in thread
From: me @ 2015-11-30 16:55 UTC (permalink / raw)
To: ruby-core
Issue #11595 has been updated by David Celis.
Yasuhiro Nakamura wrote:
> Anyway I write a patch.
>
> Is it a bug? or specification?
To me it seems like a bug, since the expectation is that Time#utc? would return true for any time with an offset of 0
----------------------------------------
Bug #11595: Time#utc? and Time#gmt? return misleading results based on $TZ
https://bugs.ruby-lang.org/issues/11595#change-55169
* Author: David Celis
* Status: Open
* Priority: Normal
* Assignee: Akira Tanaka
* ruby -v: ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
There is an issue with Time#utc? and its alias, Time#gmt?, that return misleading results based on the value of the TZ environment variable. It seems that the only way for a Time instance to return `true` for `utc?` is if you explicitly call `#utc` on it before:
~~~
ENV['TZ'] = 'UTC'
# => "UTC"
time = Time.now
# => 2015-10-14 19:30:00 +0000
time.utc?
# => false
time = time.utc
# => 2015-10-14 19:30:00 UTC
time.utc?
# => true
~~~
This seems misleading based on the value of $TZ being "UTC". The expected result for calling `Time.now.utc?` in this case would be `true`, as would that be expected for time zones that are considered links to "UTC" based on the [tzdata list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). These include "UTC", "GMT", "Etc/UTC", "Etc/GMT", "Universal", etc.
---Files--------------------------------
time_utc.patch (927 Bytes)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* [ruby-core:73320] [Ruby trunk - Bug #11595] Time#utc? and Time#gmt? return misleading results based on $TZ
[not found] <redmine.issue-11595.20151014193359@ruby-lang.org>
` (3 preceding siblings ...)
2015-11-30 16:55 ` [ruby-core:71759] " me
@ 2016-01-23 18:55 ` andrew
2016-11-05 16:09 ` [ruby-core:77990] [Ruby trunk Bug#11595][Rejected] " akr
5 siblings, 0 replies; 6+ messages in thread
From: andrew @ 2016-01-23 18:55 UTC (permalink / raw)
To: ruby-core
Issue #11595 has been updated by Andrew Vit.
Careful: not every time with offset 0 is UTC.
A time zone with offset +0100/-0100 may have DST rules, and should not be `utc?`.
----------------------------------------
Bug #11595: Time#utc? and Time#gmt? return misleading results based on $TZ
https://bugs.ruby-lang.org/issues/11595#change-56549
* Author: David Celis
* Status: Open
* Priority: Normal
* Assignee: Akira Tanaka
* ruby -v: ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
There is an issue with Time#utc? and its alias, Time#gmt?, that return misleading results based on the value of the TZ environment variable. It seems that the only way for a Time instance to return `true` for `utc?` is if you explicitly call `#utc` on it before:
~~~
ENV['TZ'] = 'UTC'
# => "UTC"
time = Time.now
# => 2015-10-14 19:30:00 +0000
time.utc?
# => false
time = time.utc
# => 2015-10-14 19:30:00 UTC
time.utc?
# => true
~~~
This seems misleading based on the value of $TZ being "UTC". The expected result for calling `Time.now.utc?` in this case would be `true`, as would that be expected for time zones that are considered links to "UTC" based on the [tzdata list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). These include "UTC", "GMT", "Etc/UTC", "Etc/GMT", "Universal", etc.
---Files--------------------------------
time_utc.patch (927 Bytes)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* [ruby-core:77990] [Ruby trunk Bug#11595][Rejected] Time#utc? and Time#gmt? return misleading results based on $TZ
[not found] <redmine.issue-11595.20151014193359@ruby-lang.org>
` (4 preceding siblings ...)
2016-01-23 18:55 ` [ruby-core:73320] " andrew
@ 2016-11-05 16:09 ` akr
5 siblings, 0 replies; 6+ messages in thread
From: akr @ 2016-11-05 16:09 UTC (permalink / raw)
To: ruby-core
Issue #11595 has been updated by Akira Tanaka.
Status changed from Open to Rejected
Current behavior is intentional.
Time#utc? returns the mode of Time object, not the time zone offset is zero.
The mode affects several methods.
For example, Time#to_s generates "UTC" for UTC Time objects and
numeric timezone offset string for non-UTC Time objects.
The result of Time#utc? method means the difference of them.
```
% TZ=GMT ruby -e '
u = Time.utc(2000)
l = Time.local(2000)
p [u, u.utc?]
p [l, l.utc?]'
[2000-01-01 00:00:00 UTC, true]
[2000-01-01 00:00:00 +0000, false]
```
----------------------------------------
Bug #11595: Time#utc? and Time#gmt? return misleading results based on $TZ
https://bugs.ruby-lang.org/issues/11595#change-61327
* Author: David Celis
* Status: Rejected
* Priority: Normal
* Assignee: Akira Tanaka
* ruby -v: ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
There is an issue with Time#utc? and its alias, Time#gmt?, that return misleading results based on the value of the TZ environment variable. It seems that the only way for a Time instance to return `true` for `utc?` is if you explicitly call `#utc` on it before:
~~~
ENV['TZ'] = 'UTC'
# => "UTC"
time = Time.now
# => 2015-10-14 19:30:00 +0000
time.utc?
# => false
time = time.utc
# => 2015-10-14 19:30:00 UTC
time.utc?
# => true
~~~
This seems misleading based on the value of $TZ being "UTC". The expected result for calling `Time.now.utc?` in this case would be `true`, as would that be expected for time zones that are considered links to "UTC" based on the [tzdata list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). These include "UTC", "GMT", "Etc/UTC", "Etc/GMT", "Universal", etc.
---Files--------------------------------
time_utc.patch (927 Bytes)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-11-05 15:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <redmine.issue-11595.20151014193359@ruby-lang.org>
2015-10-14 19:34 ` [ruby-core:71089] [Ruby trunk - Bug #11595] [Open] Time#utc? and Time#gmt? return misleading results based on $TZ me
2015-11-30 13:24 ` [ruby-core:71753] [Ruby trunk - Bug #11595] " yasuhiro6194
2015-11-30 13:27 ` [ruby-core:71754] " yasuhiro6194
2015-11-30 16:55 ` [ruby-core:71759] " me
2016-01-23 18:55 ` [ruby-core:73320] " andrew
2016-11-05 16:09 ` [ruby-core:77990] [Ruby trunk Bug#11595][Rejected] " akr
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).