From 2107df3c994f6d03a06898de303bb72ecac48b93 Mon Sep 17 00:00:00 2001 From: Mackenzie Clark Date: Thu, 27 Dec 2018 06:57:00 -0800 Subject: [PATCH] only support clock id 0 --- src/apis/emscripten/time.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/apis/emscripten/time.rs b/src/apis/emscripten/time.rs index 7b3ef97fa..614a38540 100644 --- a/src/apis/emscripten/time.rs +++ b/src/apis/emscripten/time.rs @@ -40,7 +40,11 @@ pub extern "C" fn _clock_gettime(clk_id: c_int, tp: c_int, instance: &mut Instan tv_nsec: i32, } - let timespec = time::get_time(); + let timespec = match clk_id { + 0 => time::get_time(), + 1 => panic!("Monotonic clock is not supported."), + _ => panic!("Clock is not supported."), + }; unsafe { let timespec_struct_ptr = instance.memory_offset_addr(0, tp as _) as *mut GuestTimeSpec;