Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
JsValueRef __stdcall WScriptJsrt::MonotonicNowCallback(JsValueRef callee, bool isConstructCall, JsValueRef *arguments, unsigned short argumentCount, void *callbackState)
{
HRESULT hr = E_FAIL;
JsValueRef returnValue = JS_INVALID_REFERENCE;
JsErrorCode errorCode = JsNoError;
IfJsrtErrorSetGo(ChakraRTInterface::JsGetUndefinedValue(&returnValue));
using std::chrono::duration_cast;
using std::chrono::milliseconds;
using std::chrono::steady_clock;
double now = duration_cast<milliseconds>(steady_clock::now().time_since_epoch()).count();
ChakraRTInterface::JsNumberToDouble(now, &returnValue);
return returnValue;
Error:
return returnValue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.