mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
for #742, use ms for application clock tbn.
This commit is contained in:
parent
dca9749f37
commit
3fe338d1c5
43 changed files with 437 additions and 435 deletions
|
@ -135,8 +135,7 @@ int64_t srs_update_system_time_ms()
|
|||
// use date +%s to get system time is 1403844851.
|
||||
// so we use relative time.
|
||||
if (_srs_system_time_us_cache <= 0) {
|
||||
_srs_system_time_us_cache = now_us;
|
||||
_srs_system_time_startup_time = now_us;
|
||||
_srs_system_time_startup_time = _srs_system_time_us_cache = now_us;
|
||||
return _srs_system_time_us_cache / 1000;
|
||||
}
|
||||
|
||||
|
@ -144,15 +143,13 @@ int64_t srs_update_system_time_ms()
|
|||
int64_t diff = now_us - _srs_system_time_us_cache;
|
||||
diff = srs_max(0, diff);
|
||||
if (diff < 0 || diff > 1000 * SYS_TIME_RESOLUTION_US) {
|
||||
srs_warn("system time jump, history=%"PRId64"us, now=%"PRId64"us, diff=%"PRId64"us",
|
||||
_srs_system_time_us_cache, now_us, diff);
|
||||
srs_warn("clock jump, history=%"PRId64"us, now=%"PRId64"us, diff=%"PRId64"us", _srs_system_time_us_cache, now_us, diff);
|
||||
// @see: https://github.com/ossrs/srs/issues/109
|
||||
_srs_system_time_startup_time += diff;
|
||||
}
|
||||
|
||||
_srs_system_time_us_cache = now_us;
|
||||
srs_info("system time updated, startup=%"PRId64"us, now=%"PRId64"us",
|
||||
_srs_system_time_startup_time, _srs_system_time_us_cache);
|
||||
srs_info("clock updated, startup=%"PRId64"us, now=%"PRId64"us", _srs_system_time_startup_time, _srs_system_time_us_cache);
|
||||
|
||||
return _srs_system_time_us_cache / 1000;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue