[asterisk-dev] timeval.tv_sec is time_t. How to print/scan?

Alexander Traud pabstraud at compuserve.com
Sat Feb 17 05:58:43 CST 2018


While compiling Asterisk on OpenBSD, I get a lot of warnings about the
usage of data-type time_t, when used in combination with printf/scanf,
for example in the file res_http_media_cache.c:

struct timeval actual_expires = ast_tvnow(); // gettimeofday(&t, NULL);
snprintf(time_buf, sizeof(time_buf), "%30lu", actual_expires.tv_sec);

On the Internet, there are a lot of suggestions, like
<http://stackoverflow.com/q/27057677>. Which approach does the Asterisk
team prefer? Or should I create a new issue report with all findings so
that somebody else can look into each of those?





More information about the asterisk-dev mailing list