Re: MinGW port - initial work uploaded

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Mon, 22 Jan 2007, Christian MICHON wrote:
> 
> One problem I haven't found a solution for though: the date
> of commit is wrong, always back to epoch (1970???).

Without knowing MinGW, I'd assume it's one of two issues:

 - parse_date will probably do this when the date is empty. The way git 
   works, is it takes the date from the GIT_COMMITTER|AUTHOR_DATE 
   environment variables, and it depends on getenv() returning NULL if 
   that environment variable isn't set.

   Maybe getenv() under MinGW always returns a real string, and it's just 
   empty? If so, get_ident() should probably be changed from doing

	if (date_str)
		parse_date(...)

   to

	if (date_str && *date_str)
		parse_date(...)

   or something like that.

 - datestamp() uses "time()" to get the number of seconds since the epoch. 
   HOWEVER, it does it by actually doing

	time_t now;

	time(&now);

   which is proper, but maybe a bit unusual. Try changing that to

	now = time(NULL);

   and see if that changes behaviour (it's datestamp() in date.c).

   Alternatively, if "time()" just doesn't work in MinGW, just use 
   gettimeofday() instead, something like

	time_t now;
	int offset;
	struct timeval tv;
	struct timezone tz;

	/* Just in case not everybody necessarily fills in TZ correctly.. */
	memset(&tz, 0, sizeof(tz));
	gettimeofday(&tv, &tz);
	now = tv.tv_sec;
	offset = tz.tz_minuteswest;

   instead of the current mess with localtime() and company.

   [ NOTE NOTE NOTE! The above gettimeofday() thing has NOT been tested. 
     Using the "tz" value to gettimeofday() is generally considered a bug, 
     and shouldn't really be done. It's very traditional (read: 
     old-fashioned) and very incorrect (it will ignore the TZ variable, 
     and ask the kernel, which generally has no clue at all about 
     timezones). But maybe it works on MinGW, so it might be worth 
     testing. ]

Anyway. I have no idea of Windows or MinGW, or what you did to make it all 
compile, so..

		Linus
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]