git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] 64-bit fix for date.c.

From
Bernd Ahlers <bernd@ba-net.org>
Date
Apr 6, 2009, 17:26 UTC
Message-ID
<20090406172637.GA17437@jenna.bytemine.net>
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
Next: Jeff King
Message 1 of 7 in “64-bit fix for date.c.”
  1. 64-bit fix for date.c.Bernd Ahlers, Apr 6, 2009
  2. Jeff KingApr 6, 2009
  3. Bernd AhlersMay 4, 2009
  4. Jeff KingMay 4, 2009
  5. Junio C HamanoMay 6, 2009
  6. Tony FinchMay 6, 2009
  7. Jeff KingMay 6, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.