Skip to content

Commit

Permalink
issue ossrs#3978: improve st_utime's default impl.
Browse files Browse the repository at this point in the history
  • Loading branch information
suzp1984 committed Mar 7, 2024
1 parent fa8096a commit c3ee990
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions trunk/3rdparty/st-srs/md.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ extern void _st_md_cxt_restore(_st_jmp_buf_t env, int val);
#define MD_HAVE_SOCKLEN_T
/*
* All architectures and flavors of linux have the gettimeofday
* function but if you know of a faster way, use it.
* https://github.com/ossrs/srs/issues/3978
* use clock_gettime to get the timestamp in microseconds.
*/
#define MD_GET_UTIME() \
struct timeval tv; \
(void) gettimeofday(&tv, NULL); \
return (tv.tv_sec * 1000000LL + tv.tv_usec)
#define MD_GET_UTIME() \
struct timespec ts; \
clock_gettime(CLOCK_MONOTONIC, &ts); \
return (ts.tv_sec * 1000000LL + ts.tv_nsec / 1000)

#if defined(__i386__)
#define MD_GET_SP(_t) *((long *)&((_t)->context[0].__jmpbuf[4]))
Expand Down

0 comments on commit c3ee990

Please sign in to comment.