mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Refine srs_update_system_time in time unit
This commit is contained in:
parent
9b1222a79c
commit
9b7c0802a9
17 changed files with 64 additions and 47 deletions
|
@ -107,7 +107,7 @@ int64_t _srs_system_time_startup_time = 0;
|
|||
int64_t srs_get_system_time_ms()
|
||||
{
|
||||
if (_srs_system_time_us_cache <= 0) {
|
||||
srs_update_system_time_ms();
|
||||
srs_update_system_time();
|
||||
}
|
||||
|
||||
return _srs_system_time_us_cache / 1000;
|
||||
|
@ -116,13 +116,13 @@ int64_t srs_get_system_time_ms()
|
|||
int64_t srs_get_system_startup_time_ms()
|
||||
{
|
||||
if (_srs_system_time_startup_time <= 0) {
|
||||
srs_update_system_time_ms();
|
||||
srs_update_system_time();
|
||||
}
|
||||
|
||||
return _srs_system_time_startup_time / 1000;
|
||||
}
|
||||
|
||||
int64_t srs_update_system_time_ms()
|
||||
srs_utime_t srs_update_system_time()
|
||||
{
|
||||
timeval now;
|
||||
|
||||
|
@ -143,7 +143,7 @@ int64_t srs_update_system_time_ms()
|
|||
// so we use relative time.
|
||||
if (_srs_system_time_us_cache <= 0) {
|
||||
_srs_system_time_startup_time = _srs_system_time_us_cache = now_us;
|
||||
return _srs_system_time_us_cache / 1000;
|
||||
return _srs_system_time_us_cache;
|
||||
}
|
||||
|
||||
// use relative time.
|
||||
|
@ -158,7 +158,7 @@ int64_t srs_update_system_time_ms()
|
|||
_srs_system_time_us_cache = now_us;
|
||||
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;
|
||||
return _srs_system_time_us_cache;
|
||||
}
|
||||
|
||||
string srs_dns_resolve(string host, int& family)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue