git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 64-bit fix for date.c.
@ 2009-04-06 17:26 Bernd Ahlers
  2009-04-06 19:06 ` Jeff King
  0 siblings, 1 reply; 7+ messages in thread
From: Bernd Ahlers @ 2009-04-06 17:26 UTC (permalink / raw)
  To: git

Hello!

This unbreaks the localtime_r call on OpenBSD/sparc64 and removes
the following compiler warning.

"passing arg 1 of `localtime_r' from incompatible pointer type"
---
 date.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/date.c b/date.c
index 1165d30..409a17d 100644
--- a/date.c
+++ b/date.c
@@ -871,13 +871,15 @@ unsigned long approxidate(const char *date)
 	int number = 0;
 	struct tm tm, now;
 	struct timeval tv;
+	time_t time_sec;
 	char buffer[50];
 
 	if (parse_date(date, buffer, sizeof(buffer)) > 0)
 		return strtoul(buffer, NULL, 10);
 
 	gettimeofday(&tv, NULL);
-	localtime_r(&tv.tv_sec, &tm);
+	time_sec = tv.tv_sec;
+	localtime_r(&time_sec, &tm);
 	now = tm;
 	for (;;) {
 		unsigned char c = *date;
-- 
1.6.2.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-05-06 16:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-06 17:26 [PATCH] 64-bit fix for date.c Bernd Ahlers
2009-04-06 19:06 ` Jeff King
2009-05-04 14:26   ` Bernd Ahlers
2009-05-04 14:31     ` Jeff King
2009-05-06  5:51       ` Junio C Hamano
2009-05-06 14:26         ` Tony Finch
2009-05-06 16:49           ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).