> --- a/src/openvpn/otime.h > +++ b/src/openvpn/otime.h > @@ -78,13 +78,9 @@ openvpn_gettimeofday(struct timeval *tv, void *tz) > static inline void > update_time(void) > { > -#ifdef _WIN32 > - /* on _WIN32, gettimeofday is faster than time(NULL) */ > + /* can't use time(NULL), now_usec needs to be updated */ > struct timeval tv; > openvpn_gettimeofday(&tv, NULL); > -#else > - update_now(time(NULL)); > -#endif > } > > #else /* !TIME_BACKTRACK_PROTECTION */ >
I am hesitant about this change, it mentions that gettimeofday is faster on Windows than time(NULL) and we prefer it there for this reason. But that also implies it is the other way round on other platforms. The update_time function is called in multiple critical places. Do we have any idea about this? I remember vaguely that the default gettimeofday in FreeBSD is more accurate than the Linux variant (involves a kernel call) but you can request a version similar to the Linux one by some flag (reading from a shared readonly memory page that is read only). Arne
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel