MKCKR
00b92f42b6
fix compile error in VS2012 in evutil_gettimeofday()
...
Move static variable definition before other statement, to prevent
compile error in VS2012.
Fixes : #1135
2021-02-17 01:11:07 +03:00
Nick Grifka
f0b3160f8c
evutil_time: improve evutil_gettimeofday on Windows
...
If present, use GetSystemTimePreciseAsFileTime instead of
GetSystemTimeAsFileTime. Available since Windows 8.
2020-04-29 00:53:03 +03:00
yuangongji
6412f34f24
evutil_time: Implements usleep() using wait funtion on Windows
2019-12-31 00:37:29 +03:00
yuangongji
148d12ad31
evutil_time: detect and use _gmtime64_s()/_gmtime64()
2019-09-19 15:52:49 +08:00
Azat Khuzhin
35258a1f4e
Replace all EVENT_HAVE with EVENT__HAVE (EVENT__HAVE_USLEEP)
2018-06-19 10:19:40 +03:00
Philip Prindeville
33baa4e59f
Avoid possible SEGVs in select() (in unit tests)
...
Per the POSIX definition of select():
http://pubs.opengroup.org/onlinepubs/009696699/functions/pselect.html
"Upon successful completion, the select() function may modify the object
pointed to by the timout argument."
If "struct timeval" pointer is a "static const", it could potentially
be allocated in a RO text segment. The kernel would then try to copy
back the modified value (with the time remaining) into a read-only
address and SEGV.
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Closes : #614
2018-03-30 01:24:25 +03:00
Azat Khuzhin
4798de6c64
test: fix util/date_rfc1123 under win32
...
Refs: #417
v2: check when gmtime() returns NULL
v3: fix overflow cases
2016-12-22 18:10:24 +03:00
Azat Khuzhin
4545807db4
Fix UB in evutil_date_rfc1123()
...
As pointed in https://github.com/libevent/libevent/pull/417#issuecomment-267860738
"code is unsafe because in evutil_date_rfc1123() the pointer to the
automatic variable struct tm cur is used outside the scope it defined."
Checked with `clang -fsanitize=address -fsanitize-address-use-after-scope`
and test that call evutil_date_rfc1123() with tm==NULL
2016-12-22 14:46:38 +03:00
Vis Virial
db60ade81d
http: do not use local settings for Date header
2016-12-19 00:55:50 +03:00
Azat Khuzhin
3e75194cb5
evutil_time: include <unistd.h> when there is only sleep()/usleep()
2016-12-06 12:54:05 +03:00
Andrea Shepard
f2645f80c1
Implement new/free for struct evutil_monotonic_timer and export monotonic time functions
2014-12-04 09:30:20 -05:00
Nick Mathewson
911abf3dd2
Check CLOCK_MONOTONIC_* at runtime if needed.
...
(We need this to avoid compile errors on cygwin. Fixes github issue
75.)
2013-08-19 10:14:43 -04:00
Nick Mathewson
85a40040d1
Add regress_finalize to makefile.nmake
2013-05-01 13:37:57 -04:00
Nick Mathewson
9be546809a
Avoid unused-var warning on systems with clock_gettime but without CLOCK_MONOTONIC_COARSE
2012-08-02 12:35:49 -04:00
Nick Mathewson
630f077c29
Simple unit tests for monotonic timers
2012-04-26 16:42:21 -04:00
Nick Mathewson
2c470452fb
Implement fast/precise monotonic clocks on Windows
...
This uses code from libutp, which was released under the MIT
license; see evutil_time.c and LICENSE changes.
2012-04-26 15:44:37 -04:00
Nick Mathewson
f5e4eb05e5
Refactor monotonic timer handling into a new type and set of functions; add a gettimeofday-based ratcheting implementation
...
Now, event.c can always assume that we have a monotonic timer; this
makes event.c easier to write.
2012-04-26 15:44:31 -04:00
Nick Mathewson
71bca50f12
Split out time-related prototypes into time-internal.h
2012-04-20 12:27:12 -04:00
Nick Mathewson
c419485442
Split out time-related evutil functions into a new evutil_time.c
2012-04-20 12:19:03 -04:00