Issue #8376 has been updated by mosselman (Achilleas Buisman).


naruse (Yui NARUSE) wrote:
> Time#utc is destructive method.
> Use dup if you want a copy.

That seems the point of this issue. The behaviour is inconsistent. `t.utc!` should be the way to destroy `t` in the example. This should be changed... ruby isn't PHP.

----------------------------------------
Bug #8376: utc method changes original time object
https://bugs.ruby-lang.org/issues/8376#change-39178

Author: arjan0307 (Arjan Diepenbroek)
Status: Rejected
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: 1.8.7, 1.9.3, 2.0.0
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


The utc method changes the original time object when called.

For example when on a system with a CET timezone.

t = Time.new(2013)
t.zone # CET
t.utc
t.zone # UTC


-- 
http://bugs.ruby-lang.org/