Dual-Life / Time-Piece

Object Oriented time objects
Other
15 stars 33 forks source link

Copy time parts before modifying for copy constructor #36

Closed Grinnz closed 6 years ago

Grinnz commented 6 years ago

The only time _mktime is called with an array reference not created internally is when using the copy constructor: Time::Piece->new($obj). In this instance, the epoch field of $obj was inadvertently modified before copying the values to the new object.

Grinnz commented 6 years ago

This issue only became visible because of another issue; the copy constructor always passes its argument to localtime(), which erroneously will interpret a UTC Time::Piece object as localtime and copy it incorrectly. I will open another PR for that issue.