Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-hackers by date

Next:From: =?iso-8859-1?B?QW5kcukgRmVybmFuZGVz?=Date: 2010-09-24 15:29:42
Subject: Re: Name column
Previous:From: Dave PageDate: 2010-09-24 15:22:17
Subject: Re: Re: [BUGS] BUG #5650: Postgres service showing as stopped when in fact it is running

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group