[Git][NTPsec/ntpsec][master] A note on avoiding struct timeval.

Eric S. Raymond gitlab at mg.gitlab.com
Sat Oct 1 15:09:51 UTC 2016

Eric S. Raymond pushed to branch master at NTPsec / ntpsec

42e2211d by Eric S. Raymond at 2016-10-01T11:09:41-04:00
A note on avoiding struct timeval.

- - - - -

1 changed file:

- devel/hacking.txt


--- a/devel/hacking.txt
+++ b/devel/hacking.txt
@@ -82,6 +82,21 @@ http://www.unix.org/whitepapers/reentrant.html[Thread-safety and POSIX.1]
 All C files should be in plain US-ASCII encoding; do not use trigraphs.
+=== Other interfaces to be avoided ===
+Don't use gettimeofday(2).  While this is nominally POSIX, it is
+deprecated and may be removed in the future.  Use clock_gettime(2)
+Use pselect(2) rather that select(2), to avoid introducing struct
+In general, avoid introducing the type struct timeval into the code,
+in favor of the higher-resolution struct timespec. Early on in
+NTPsec's history we found a bug introduced by poor data management
+where these two time representations bumped into each other; we don't
+want that to happen again.
 === Coding style and indentation ==
 Dr. Dave Mills likes this code indented formatted in a consistent way.

View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/42e2211d15e19c92b67851b928f15096ac5d89ae
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161001/a2ce3535/attachment.html>

More information about the vc mailing list