1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-16 14:04:52 +01:00
git/perl
Ben Walton 75f7b5dfc4 perl/Git.pm: fix get_tz_offset to properly handle DST boundary cases
When passed a local time that was on the boundary of a DST change,
get_tz_offset returned a GMT offset that was incorrect (off by one
hour).  This is because the time was converted to GMT and then back to
a time stamp via timelocal() which cannot disambiguate boundary cases
as noted in its documentation.

Modify this algorithm, using an approach suggested in

  http://article.gmane.org/gmane.comp.version-control.git/213871

to first convert the timestamp in question to two broken down forms
with localtime() and gmtime(), and then compute what timestamps
these two broken down forms would represent in GMT (i.e. a timezone
that does not have DST issues) by applying timegm() on them.  The
difference between the resulting timestamps is the timezone offset.

This avoids the ambigious conversion and allows a correct time to be
returned on every occassion.

Signed-off-by: Ben Walton <bdwalton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-09 14:34:18 -08:00
..
Git Move Git::SVN::get_tz to Git::get_tz_offset 2013-02-09 14:01:28 -08:00
.gitignore perl: detect new files in MakeMaker builds 2012-07-27 22:14:02 +00:00
Git.pm perl/Git.pm: fix get_tz_offset to properly handle DST boundary cases 2013-02-09 14:34:18 -08:00
Makefile Extract Git::SVN::GlobSpec from git-svn. 2012-07-27 22:36:19 +00:00
Makefile.PL The Makefile.PL will now find .pm files itself. 2012-07-27 22:13:28 +00:00
private-Error.pm