Skip to content

Commit

Permalink
tmr: reuse tmr_jiffies_usec (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredh authored Mar 4, 2022
1 parent a0624e2 commit 947245d
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions src/tmr/tmr.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,28 +166,7 @@ uint64_t tmr_jiffies_usec(void)
*/
uint64_t tmr_jiffies(void)
{
uint64_t jfs;

#if defined(WIN32)
FILETIME ft;
ULARGE_INTEGER li;
GetSystemTimeAsFileTime(&ft);
li.LowPart = ft.dwLowDateTime;
li.HighPart = ft.dwHighDateTime;
jfs = li.QuadPart/10/1000;
#else
struct timeval now;

if (0 != gettimeofday(&now, NULL)) {
DEBUG_WARNING("jiffies: gettimeofday() failed (%m)\n", errno);
return 0;
}

jfs = (long)now.tv_sec * (uint64_t)1000;
jfs += now.tv_usec / 1000;
#endif

return jfs;
return tmr_jiffies_usec() / 1000;
}


Expand Down

0 comments on commit 947245d

Please sign in to comment.