All of lore.kernel.org
 help / color / mirror / Atom feed
* trace.c: struct timeval tv not portable
@ 2014-06-29  6:53 Torsten Bögershausen
  0 siblings, 0 replies; only message in thread
From: Torsten Bögershausen @ 2014-06-29  6:53 UTC (permalink / raw)
  To: Karsten Blees, Git Mailing List


The following printout gives a warning:
(trace.c, arounf line 105)
	strbuf_addf(buf, "%02d:%02d:%02d.%06ld ", tm.tm_hour, tm.tm_min,
		    tm.tm_sec, tv.tv_usec);
trace.c:105: warning: format ‘%06ld’ expects type ‘long int’, but argument 6 has type ‘__darwin_suseconds_t’


A format string of  "%06ld" for is not always good for tv.tv_usec

http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/time.h.html

A better solution would be:

	strbuf_addf(buf, "%02d:%02d:%02d.%06ld ", tm.tm_hour, tm.tm_min,
		    tm.tm_sec, (long int)tv.tv_usec);

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

only message in thread, other threads:[~2014-06-29  6:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-29  6:53 trace.c: struct timeval tv not portable Torsten Bögershausen

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.