Re: git cherry-pick timestamping issue

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: git cherry-pick timestamping issue
Date: 2010-09-24 15:23:10
Message-ID: 1745.1285341790@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> Apparently somebody's confused between local and GMT time somewhere in
> there.

For the archives' sake: this turns out to be a portability issue not
handled by the git code. If you are running on a platform old enough
to have gmtime_r returning int rather than struct tm *, you need this
patch:

*** date.c~ Sat Sep 18 19:43:54 2010
--- date.c Fri Sep 24 10:57:28 2010
***************
*** 406,412 ****
case '.':
now = time(NULL);
refuse_future = NULL;
! if (gmtime_r(&now, &now_tm))
refuse_future = &now_tm;

if (num > 70) {
--- 406,412 ----
case '.':
now = time(NULL);
refuse_future = NULL;
! if (gmtime_r(&now, &now_tm) == 0)
refuse_future = &now_tm;

if (num > 70) {
***************
*** 469,475 ****
*/
if (num >= 100000000 && nodate(tm)) {
time_t time = num;
! if (gmtime_r(&time, tm)) {
*tm_gmt = 1;
return end - date;
}
--- 469,475 ----
*/
if (num >= 100000000 && nodate(tm)) {
time_t time = num;
! if (gmtime_r(&time, tm) == 0) {
*tm_gmt = 1;
return end - date;
}

[ /me resolves to actually run a program's regression tests before
assuming it works ]

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message André Fernandes 2010-09-24 15:29:42 Re: Name column
Previous Message Dave Page 2010-09-24 15:22:17 Re: Re: [BUGS] BUG #5650: Postgres service showing as stopped when in fact it is running