All of lore.kernel.org
 help / color / mirror / Atom feed
* time casts
@ 2005-06-15 15:30 Jason Wright
  0 siblings, 0 replies; only message in thread
From: Jason Wright @ 2005-06-15 15:30 UTC (permalink / raw)
  To: git

In porting cogito/git 0.11.3 to OpenBSD, I ran into casts of time_t
warnings for the printfs below.  I think the warnings are harmless, but
the patch below fixes 'em.

--Jason L. Wright

--- date.c.orig	Wed Jun 15 11:21:00 2005
+++ date.c	Wed Jun 15 11:21:30 2005
@@ -438,7 +438,8 @@ void parse_date(char *date, char *result
 		sign = '-';
 	}
 
-	snprintf(result, maxlen, "%lu %c%02d%02d", then, sign, offset/60, offset % 60);
+	snprintf(result, maxlen, "%lu %c%02d%02d", (unsigned long)then,
+	    sign, offset/60, offset % 60);
 }
 
 void datestamp(char *buf, int bufsize)
@@ -451,5 +452,6 @@ void datestamp(char *buf, int bufsize)
 	offset = my_mktime(localtime(&now)) - now;
 	offset /= 60;
 
-	snprintf(buf, bufsize, "%lu %+05d", now, offset/60*100 + offset%60);
+	snprintf(buf, bufsize, "%lu %+05d", (unsigned long)now,
+	    offset/60*100 + offset%60);
 }
--- tar-tree.c.orig	Wed Jun 15 11:24:07 2005
+++ tar-tree.c	Wed Jun 15 11:24:55 2005
@@ -318,7 +318,7 @@ static void write_header(const unsigned 
 	if (S_ISDIR(mode) || S_ISLNK(mode))
 		size = 0;
 	sprintf(&header[124], "%011lo", size);
-	sprintf(&header[136], "%011lo", archive_time);
+	sprintf(&header[136], "%011lo", (unsigned)archive_time);
 
 	header[156] = typeflag;
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-06-15 15:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-15 15:30 time casts Jason Wright

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.