{"thread":{"id":"6539","subject":"[PATCH 1/2] UNIX reference time of 1970-01-01 00:00 is UTC timezone, not local time zone","startedAt":"2007-01-26T08:58:48Z","lastAt":"2007-01-26T17:49:07Z","messageCount":3,"participants":["Andy Parkins","Simon 'corecode' Schubert"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"32695","messageId":"200701260858.48212.andyparkins@gmail.com","threadId":"6539","inReplyTo":null,"subject":"[PATCH 1/2] UNIX reference time of 1970-01-01 00:00 is UTC timezone, not local time zone","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2007-01-26T08:58:48Z","receivedAt":"2007-01-26T08:58:48Z","isPatch":true,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"I got bitten because in the UK (where one would expect 1970-01-01 00:00\nto be UTC 0) some politicians decided to mess around with daylight\nsavings time from 1968 to 1971; it was permanently BST (+0100).  That\nmeans that on my computer the following is true:\n\n$ date --date=\"1970-01-01 00:00\" +\"%F %T %z (%Z)\"\n1970-01-01 00:00:00 +0100 (BST)\n\nThis of course means that the --date argument to date is specified in\nlocal time, not UTC.  So when the hooks--update script does this:\n\ndate=$(date --date=\"1970-01-01 00:00:00 +0000 $ts seconds\")\n\nIt's actually saying (in my timezone) \"1970-01-01 01:00:00 UTC\" + $ts.\nClearly this is wrong.  The UNIX epoch started at midnight UTC not 1am\nUTC.\n\nThis leads to the tagged time in hooks--update being shown as one hour\nearlier than the true tagged time (in my timezone).  The problem would\nbe worse for other timezones.  For a +1300 timezone on 1970-01-01, the\ntagged time would be 13 hours earlier.  Oops.\n\nThe solution is to force the reference time to UTC, which is what this\npatch does.  In my timezone:\n\n$ date --date=\"1970-01-01 00:00 +0000\" +\"%F %T %z (%Z)\"\n1970-01-01 01:00:00 +0100 (BST)\n\nMuch better.\n\nSigned-off-by: Andy Parkins <andyparkins@gmail.com>\n---\n templates/hooks--update |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/templates/hooks--update b/templates/hooks--update\nindex 9863a80..81f706f 100644\n--- a/templates/hooks--update\n+++ b/templates/hooks--update\n@@ -46,7 +46,7 @@ then\n \t\tif [ \"$ref_type\" = tag ]; then\n \t\t\teval $(git cat-file tag $3 | \\\n \t\t\t\tsed -n '4s/tagger \\([^>]*>\\)[^0-9]*\\([0-9]*\\).*/tagger=\"\\1\" ts=\"\\2\"/p')\n-\t\t\tdate=$(date --date=\"1970-01-01 00:00:00 $ts seconds\" +\"$date_format\")\n+\t\t\tdate=$(date --date=\"1970-01-01 00:00:00 +0000 $ts seconds\" +\"$date_format\")\n \t\t\techo \"Tag '$tag' created by $tagger at $date\"\n \t\t\tgit cat-file tag $3 | sed -n '5,$p'\n \t\t\techo\n-- \n1.5.0.rc2.g017f3\n"},{"id":"32706","messageId":"200701260943.55735.andyparkins@gmail.com","threadId":"6539","inReplyTo":"200701260858.48212.andyparkins@gmail.com","subject":"Re: [PATCH 1/2] UNIX reference time of 1970-01-01 00:00 is UTC timezone, not local time zone","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2007-01-26T09:43:54Z","receivedAt":"2007-01-26T09:43:54Z","isPatch":true,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"On Friday 2007 January 26 08:58, Andy Parkins wrote:\n\n> This of course means that the --date argument to date is specified in\n> local time, not UTC.  So when the hooks--update script does this:\n>\n> date=$(date --date=\"1970-01-01 00:00:00 +0000 $ts seconds\")\n\nBugger.  This description is wrong.  I've shown the fixed version not the \noriginal.  This line should have read\n\n date=$(date --date=\"1970-01-01 00:00:00 $ts seconds\")\n\nSorry - patch was fine, message needs that change to make sense though.\n\n\nAndy\n-- \nDr Andy Parkins, M Eng (hons), MIEE\nandyparkins@gmail.com\n"},{"id":"32760","messageId":"45BA3F13.2090003@fs.ei.tum.de","threadId":"6539","inReplyTo":"200701260858.48212.andyparkins@gmail.com","subject":"Re: [PATCH 1/2] UNIX reference time of 1970-01-01 00:00 is UTC timezone, not local time zone","fromName":"Simon 'corecode' Schubert","fromEmail":"corecode@fs.ei.tum.de","sentAt":"2007-01-26T17:49:07Z","receivedAt":"2007-01-26T17:49:07Z","isPatch":true,"sender":{"key":"corecode@fs.ei.tum.de","avatar":"https://gravatar.com/avatar/eff9dbf0cdac0d1e6a6cd7ed0e50763edcb376b493b5253a35ff167918ad79e1?d=mp&s=160"},"body":"Andy Parkins wrote:\n> $ date --date=\"1970-01-01 00:00\" +\"%F %T %z (%Z)\"\n> 1970-01-01 00:00:00 +0100 (BST)\n\nnice observation.  yet, my system doesn't even have date --date=.  regarding the idea to provide a generic nice hook, it should be considered to convert this usage to a standards-conforming way.\n\ncheers\n  simon\n\n-- \nServe - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /\"\\\nWork - Mac      +++  space for low €€€ NOW!1  +++      Campaign     \\ /\nParty Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \\\nDude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \\\n\n"}]}