From 0ba5f1ecb7e5c93652d931395ef6aaa66bb797c4 Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Mon, 26 Nov 2018 14:16:51 -0800 Subject: [PATCH] Added mock for _strftime --- src/apis/emscripten/mod.rs | 7 ++++++- src/apis/emscripten/time.rs | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/apis/emscripten/mod.rs b/src/apis/emscripten/mod.rs index e83ab928f..dfa84056f 100644 --- a/src/apis/emscripten/mod.rs +++ b/src/apis/emscripten/mod.rs @@ -329,6 +329,11 @@ pub fn generate_emscripten_env<'a, 'b>() -> ImportObject<&'a str, &'b str> { "_time", ImportValue::Func(time::_time as _), ); + import_object.set( + "env", + "_strftime", + ImportValue::Func(time::_strftime as _), + ); import_object.set( "env", "_localtime_r", @@ -345,7 +350,7 @@ pub fn generate_emscripten_env<'a, 'b>() -> ImportObject<&'a str, &'b str> { mock_external!(import_object, _usleep); // mock_external!(import_object, _time); mock_external!(import_object, _sysconf); - mock_external!(import_object, _strftime); + // mock_external!(import_object, _strftime); mock_external!(import_object, _sigsuspend); mock_external!(import_object, _sigprocmask); mock_external!(import_object, _sigemptyset); diff --git a/src/apis/emscripten/time.rs b/src/apis/emscripten/time.rs index 58495f5cb..634d77b83 100644 --- a/src/apis/emscripten/time.rs +++ b/src/apis/emscripten/time.rs @@ -82,3 +82,9 @@ pub extern "C" fn _time(time_p: u32, instance: &mut Instance) -> time_t { time(time_p_addr) } } + +/// emscripten: _strftime +pub extern "C" fn _strftime(s_ptr: c_int, maxsize: u32, format_ptr: c_int, tm_ptr: c_int, instance: &mut Instance) -> time_t { + debug!("emscripten::_strftime {} {} {} {}", s_ptr, maxsize, format_ptr, tm_ptr); + 0 +}