httpdate: favor gettimeofday(2) over time(2) for correctness
commita6463151bd1db5b9ae7a54985a200f28f543f241
authorEric Wong <bofh@yhbt.net>
Thu, 1 Jun 2023 23:58:13 +0000 (1 23:58 +0000)
committerEric Wong <bofh@yhbt.net>
Mon, 5 Jun 2023 09:17:18 +0000 (5 09:17 +0000)
tree36fd4690072983e38ade3ae8af2a85ca42a4014f
parentcaadb37fed62105fc27494593bfe3a74c309429b
httpdate: favor gettimeofday(2) over time(2) for correctness

While scanning the git@vger.kernel.org mailing list, I've
learned time(2) may return the wrong value in the first 1 to 2.5
ms of every second.  While I'm not sure if the Date: response
header matters to anyone, returning the correct time seems
prudent.

Link: https://lore.kernel.org/git/20230320230507.3932018-1-gitster@pobox.com/
Link: https://inbox.sourceware.org/libc-alpha/20230306160321.2942372-1-adhemerval.zanella@linaro.org/T/
Link: https://sourceware.org/bugzilla/show_bug.cgi?id=30200
ext/unicorn_http/httpdate.c