mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
System: Add srs duration api
This commit is contained in:
parent
f7faa13dc5
commit
7459f287e0
2 changed files with 12 additions and 0 deletions
|
@ -23,3 +23,12 @@
|
|||
|
||||
#include <srs_core_time.hpp>
|
||||
|
||||
srs_utime_t srs_duration(srs_utime_t start, srs_utime_t end)
|
||||
{
|
||||
if (start == 0 || end == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return end - start;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,9 @@ typedef int64_t srs_utime_t;
|
|||
#define srsu2ms(us) ((us) / SRS_UTIME_MILLISECONDS)
|
||||
#define srsu2msi(us) int((us) / SRS_UTIME_MILLISECONDS)
|
||||
|
||||
// Them time duration = end - start. return 0, if start or end is 0.
|
||||
srs_utime_t srs_duration(srs_utime_t start, srs_utime_t end);
|
||||
|
||||
// The time unit in ms, for example 120 * SRS_UTIME_SECONDS means 120s.
|
||||
#define SRS_UTIME_SECONDS 1000000LL
|
||||
|
||||
|
|
Loading…
Reference in a new issue