diff options
author | Kevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com> | 2019-11-24 07:42:30 -0800 |
---|---|---|
committer | Ry Dahl <ry@tinyclouds.org> | 2019-11-24 10:42:30 -0500 |
commit | bca23e64339f9b41272e4a01e4c1a86602e5c1e4 (patch) | |
tree | fe72fe56fd0f9ffa8e7392ec1941cce3300915ec /cli/ops/timers.rs | |
parent | 9e97eb287954393615ec89d42e7ca5548ecb0881 (diff) |
refactor: Elevate DenoPermissions lock to top level (#3398)
Diffstat (limited to 'cli/ops/timers.rs')
-rw-r--r-- | cli/ops/timers.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cli/ops/timers.rs b/cli/ops/timers.rs index 7223633f8..21d1eda24 100644 --- a/cli/ops/timers.rs +++ b/cli/ops/timers.rs @@ -66,11 +66,12 @@ fn op_now( let seconds = state.start_time.elapsed().as_secs(); let mut subsec_nanos = state.start_time.elapsed().subsec_nanos(); let reduced_time_precision = 2_000_000; // 2ms in nanoseconds + let permissions = state.permissions.lock().unwrap(); // If the permission is not enabled // Round the nano result on 2 milliseconds // see: https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp#Reduced_time_precision - if !state.permissions.allow_hrtime.is_allow() { + if !permissions.allow_hrtime.is_allow() { subsec_nanos -= subsec_nanos % reduced_time_precision } |