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

trace.c: struct timeval tv not portable

From
Torsten Bögershausen <tboegi@web.de>
Date
Jun 29, 2014, 06:53 UTC
Message-ID
<53AFB7F8.7070701@web.de>
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);
Message 1 of 1 in “trace.c: struct timeval tv not portable”
  1. Torsten BögershausenJun 29, 2014

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.