]> git.ipfire.org Git - thirdparty/curl.git/commit
examples/cookie_interface: avoid printfing time_t directly
authorCarlo Marcelo Arenas Belón <carenas@gmail.com>
Sat, 24 Jul 2021 18:54:30 +0000 (11:54 -0700)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 25 Jul 2021 22:55:17 +0000 (00:55 +0200)
commit4b79c4fb565ab521eb943034918d92dd7fa7db75
treeebb64e7e6af86f44c59040b622f893eb5c69573f
parent4a7bf79fcc2c7d0414d7d0a2bdc8fe4f1265739b
examples/cookie_interface: avoid printfing time_t directly

time_t representation is undefined and varies on bitsize and signedness,
and as of C11 could be even non integer.

instead of casting to unsigned long (which would truncate in systems
with a 32bit long after 2106) use difftime to get the elapsed time as a
double and print that (without decimals) instead.

alternatively a cast to curl_off_t and its corresponding print
formatting could have been used (at least in POSIX) but portability and
curl agnostic code was prioritized.

Closes #7490
docs/examples/cookie_interface.c