mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Make sure initialized_at is initialized before use.
This commit is contained in:
@@ -466,6 +466,10 @@ uint64_t
|
||||
monotime_absolute_nsec(void)
|
||||
{
|
||||
monotime_t now;
|
||||
if (BUG(monotime_initialized == 0)) {
|
||||
monotime_init();
|
||||
}
|
||||
|
||||
monotime_get(&now);
|
||||
return monotime_diff_nsec(&initialized_at, &now);
|
||||
}
|
||||
@@ -486,6 +490,10 @@ monotime_absolute_msec(void)
|
||||
uint64_t
|
||||
monotime_coarse_absolute_nsec(void)
|
||||
{
|
||||
if (BUG(monotime_initialized == 0)) {
|
||||
monotime_init();
|
||||
}
|
||||
|
||||
monotime_coarse_t now;
|
||||
monotime_coarse_get(&now);
|
||||
return monotime_coarse_diff_nsec(&initialized_at_coarse, &now);
|
||||
|
||||
Reference in New Issue
Block a user