Do not use timeval. The structure is not defined on Windows RT.
This commit is contained in:
parent
3bd6b8d074
commit
e326ef9030
@ -65,27 +65,24 @@ static Salsa20Random stream = {
|
|||||||
static uint64_t
|
static uint64_t
|
||||||
sodium_hrtime(void)
|
sodium_hrtime(void)
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
uint64_t ts;
|
||||||
uint64_t ts = (uint64_t) 0U;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
struct _timeb tb;
|
{
|
||||||
|
struct _timeb tb;
|
||||||
# pragma warning(push)
|
# pragma warning(push)
|
||||||
# pragma warning(disable: 4996)
|
# pragma warning(disable: 4996)
|
||||||
_ftime(&tb);
|
_ftime(&tb);
|
||||||
# pragma warning(pop)
|
# pragma warning(pop)
|
||||||
tv.tv_sec = (long) tb.time;
|
ts = ((uint64_t) tb.time) * 1000000U + ((uint64_t) tb.millitm) * 1000U;
|
||||||
tv.tv_usec = ((int) tb.millitm) * 1000;
|
|
||||||
ret = 0;
|
|
||||||
#else
|
|
||||||
ret = gettimeofday(&tv, NULL);
|
|
||||||
#endif
|
|
||||||
assert(ret == 0);
|
|
||||||
if (ret == 0) {
|
|
||||||
ts = (uint64_t) tv.tv_sec * 1000000U + (uint64_t) tv.tv_usec;
|
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
struct timeval tv;
|
||||||
|
assert(gettimeofday(&tv, NULL) == 0);
|
||||||
|
ts = ((uint64_t) tv.tv_sec) * 1000000U + (uint64_t) tv.tv_usec;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return ts;
|
return ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user