diff options
Diffstat (limited to 'rust/src/ffi.rs')
| -rw-r--r-- | rust/src/ffi.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/rust/src/ffi.rs b/rust/src/ffi.rs index eb584828..01835912 100644 --- a/rust/src/ffi.rs +++ b/rust/src/ffi.rs @@ -12,14 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::time::{Duration, SystemTime, UNIX_EPOCH}; + macro_rules! ffi_wrap { ($n:expr, $b:expr) => {{ use std::panic; use std::process; panic::catch_unwind(|| $b).unwrap_or_else(|_| { - error!("ffi callback caught panic: {}", $n); + log::error!("ffi callback caught panic: {}", $n); process::abort() }) }}; } + +pub(crate) fn time_from_bn(timestamp: u64) -> SystemTime { + let m = Duration::from_secs(timestamp); + UNIX_EPOCH + m +} |
