summaryrefslogtreecommitdiff
path: root/contrib/remotes2config.sh
diff options
context:
space:
mode:
authorAndy Parkins <andyparkins@gmail.com>2007-01-26 08:58:48 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-01-28 22:35:50 (GMT)
commita69aba6af3e96f8021c194691a851e78febd70bf (patch)
tree765ec3a9bd3936cfeff42af19bf780d0e2e252ba /contrib/remotes2config.sh
parent5558e55c06a1e897f3064f0c8a343d5c9858f6b2 (diff)
downloadgit-a69aba6af3e96f8021c194691a851e78febd70bf.zip
git-a69aba6af3e96f8021c194691a851e78febd70bf.tar.gz
git-a69aba6af3e96f8021c194691a851e78febd70bf.tar.bz2
UNIX reference time of 1970-01-01 00:00 is UTC timezone, not local time zone
I got bitten because in the UK (where one would expect 1970-01-01 00:00 to be UTC 0) some politicians decided to mess around with daylight savings time from 1968 to 1971; it was permanently BST (+0100). That means that on my computer the following is true: $ date --date="1970-01-01 00:00" +"%F %T %z (%Z)" 1970-01-01 00:00:00 +0100 (BST) This of course means that the --date argument to date is specified in local time, not UTC. So when the hooks--update script does this: date=$(date --date="1970-01-01 00:00:00 $ts seconds") It's actually saying (in my timezone) "1970-01-01 01:00:00 UTC" + $ts. Clearly this is wrong. The UNIX epoch started at midnight UTC not 1am UTC. This leads to the tagged time in hooks--update being shown as one hour earlier than the true tagged time (in my timezone). The problem would be worse for other timezones. For a +1300 timezone on 1970-01-01, the tagged time would be 13 hours earlier. Oops. The solution is to force the reference time to UTC, which is what this patch does. In my timezone: $ date --date="1970-01-01 00:00 +0000" +"%F %T %z (%Z)" 1970-01-01 01:00:00 +0100 (BST) Much better. Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Diffstat (limited to 'contrib/remotes2config.sh')
0 files changed, 0 insertions, 0 deletions