mirror of
https://github.com/openharmony/miscservices_time.git
synced 2026-07-19 12:02:04 -04:00
!145 黄区告警清零
Merge pull request !145 from zhangjunxi/OpenHarmony-3.2-Beta1
This commit is contained in:
@@ -169,6 +169,10 @@ napi_value JSSystemTimeSetTime(napi_env env, napi_callback_info info)
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
AsyncContext *asyncContext = (AsyncContext*)data;
|
||||
if (asyncContext == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!asyncContext->isOK) {
|
||||
asyncContext->errorCode = ERROR;
|
||||
}
|
||||
@@ -181,10 +185,8 @@ napi_value JSSystemTimeSetTime(napi_env env, napi_callback_info info)
|
||||
napi_get_null(env, &result);
|
||||
TimeReturnCallbackPromise(env, info, result);
|
||||
napi_delete_async_work(env, asyncContext->work);
|
||||
if (asyncContext) {
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
}
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void*)asyncContext,
|
||||
&asyncContext->work);
|
||||
@@ -249,6 +251,9 @@ napi_value JSSystemTimeSetTimeZone(napi_env env, napi_callback_info info)
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
AsyncContext *asyncContext = (AsyncContext*)data;
|
||||
if (asyncContext == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (!asyncContext->isOK) {
|
||||
asyncContext->errorCode = ERROR;
|
||||
}
|
||||
@@ -261,10 +266,8 @@ napi_value JSSystemTimeSetTimeZone(napi_env env, napi_callback_info info)
|
||||
napi_get_null(env, &result);
|
||||
TimeReturnCallbackPromise(env, info, result);
|
||||
napi_delete_async_work(env, asyncContext->work);
|
||||
if (asyncContext) {
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
}
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void*)asyncContext,
|
||||
&asyncContext->work);
|
||||
@@ -339,6 +342,9 @@ napi_value JSSystemTimeGetCurrentTime(napi_env env, napi_callback_info info)
|
||||
},
|
||||
[](napi_env env, napi_status status, void* data) {
|
||||
AsyncContext* asyncContext = (AsyncContext*)data;
|
||||
if (asyncContext == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (asyncContext->time < 0) {
|
||||
}
|
||||
TimeCallbackPromiseInfo info;
|
||||
@@ -350,10 +356,8 @@ napi_value JSSystemTimeGetCurrentTime(napi_env env, napi_callback_info info)
|
||||
napi_create_int64(env, asyncContext->time, &result);
|
||||
TimeReturnCallbackPromise(env, info, result);
|
||||
napi_delete_async_work(env, asyncContext->work);
|
||||
if (asyncContext) {
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
}
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void*)asyncContext,
|
||||
&asyncContext->work);
|
||||
@@ -398,6 +402,9 @@ napi_value JSSystemTimeGetRealActiveTime(napi_env env, napi_callback_info info)
|
||||
},
|
||||
[](napi_env env, napi_status status, void* data) {
|
||||
AsyncContext* asyncContext = (AsyncContext*)data;
|
||||
if (asyncContext == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (asyncContext->time < 0) {
|
||||
asyncContext->errorCode = ERROR;
|
||||
}
|
||||
@@ -410,10 +417,8 @@ napi_value JSSystemTimeGetRealActiveTime(napi_env env, napi_callback_info info)
|
||||
napi_create_int64(env, asyncContext->time, &result);
|
||||
TimeReturnCallbackPromise(env, info, result);
|
||||
napi_delete_async_work(env, asyncContext->work);
|
||||
if (asyncContext) {
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
}
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void*)asyncContext,
|
||||
&asyncContext->work);
|
||||
@@ -458,6 +463,9 @@ napi_value JSSystemTimeGetRealTime(napi_env env, napi_callback_info info)
|
||||
},
|
||||
[](napi_env env, napi_status status, void* data) {
|
||||
AsyncContext* asyncContext = (AsyncContext*)data;
|
||||
if (asyncContext == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (asyncContext->time < 0) {
|
||||
asyncContext->errorCode = ERROR;
|
||||
}
|
||||
@@ -470,10 +478,8 @@ napi_value JSSystemTimeGetRealTime(napi_env env, napi_callback_info info)
|
||||
napi_create_int64(env, asyncContext->time, &result);
|
||||
TimeReturnCallbackPromise(env, info, result);
|
||||
napi_delete_async_work(env, asyncContext->work);
|
||||
if (asyncContext) {
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
}
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void*)asyncContext,
|
||||
&asyncContext->work);
|
||||
@@ -512,6 +518,9 @@ napi_value JSSystemTimeGetDate(napi_env env, napi_callback_info info)
|
||||
},
|
||||
[](napi_env env, napi_status status, void* data) {
|
||||
AsyncContext* asyncContext = (AsyncContext*)data;
|
||||
if (asyncContext == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (asyncContext->time < 0) {
|
||||
asyncContext->errorCode = ERROR;
|
||||
}
|
||||
@@ -528,10 +537,8 @@ napi_value JSSystemTimeGetDate(napi_env env, napi_callback_info info)
|
||||
napi_run_script(env, script, &result);
|
||||
TimeReturnCallbackPromise(env, info, result);
|
||||
napi_delete_async_work(env, asyncContext->work);
|
||||
if (asyncContext) {
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
}
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void*)asyncContext,
|
||||
&asyncContext->work);
|
||||
@@ -571,6 +578,9 @@ napi_value JSSystemTimeGetTimeZone(napi_env env, napi_callback_info info)
|
||||
},
|
||||
[](napi_env env, napi_status status, void* data) {
|
||||
AsyncContext* asyncContext = (AsyncContext*)data;
|
||||
if (asyncContext == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (asyncContext->timeZone == "") {
|
||||
asyncContext->errorCode = ERROR;
|
||||
}
|
||||
@@ -583,10 +593,8 @@ napi_value JSSystemTimeGetTimeZone(napi_env env, napi_callback_info info)
|
||||
napi_create_string_utf8(env, asyncContext->timeZone.c_str(), asyncContext->timeZone.length(), &result);
|
||||
TimeReturnCallbackPromise(env, info, result);
|
||||
napi_delete_async_work(env, asyncContext->work);
|
||||
if (asyncContext) {
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
}
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void*)asyncContext,
|
||||
&asyncContext->work);
|
||||
|
||||
@@ -488,6 +488,9 @@ napi_value StartTimer(napi_env env, napi_callback_info info)
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
AsyncCallbackInfoStart *asynccallbackinfo = (AsyncCallbackInfoStart *)data;
|
||||
|
||||
if (asynccallbackinfo == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (!asynccallbackinfo->isOK) {
|
||||
asynccallbackinfo->errorCode = ERROR;
|
||||
}
|
||||
@@ -503,10 +506,8 @@ napi_value StartTimer(napi_env env, napi_callback_info info)
|
||||
ReturnCallbackPromise(env, info, result);
|
||||
|
||||
napi_delete_async_work(env, asynccallbackinfo->asyncWork);
|
||||
if (asynccallbackinfo) {
|
||||
delete asynccallbackinfo;
|
||||
asynccallbackinfo = nullptr;
|
||||
}
|
||||
delete asynccallbackinfo;
|
||||
asynccallbackinfo = nullptr;
|
||||
},
|
||||
(void *)asynccallbackinfo,
|
||||
&asynccallbackinfo->asyncWork);
|
||||
@@ -597,6 +598,9 @@ napi_value StopTimer(napi_env env, napi_callback_info info)
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
AsyncCallbackInfoStop *asynccallbackinfo = (AsyncCallbackInfoStop *)data;
|
||||
if (asynccallbackinfo == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!asynccallbackinfo->isOK) {
|
||||
asynccallbackinfo->errorCode = ERROR;
|
||||
@@ -613,10 +617,8 @@ napi_value StopTimer(napi_env env, napi_callback_info info)
|
||||
ReturnCallbackPromise(env, info, result);
|
||||
|
||||
napi_delete_async_work(env, asynccallbackinfo->asyncWork);
|
||||
if (asynccallbackinfo) {
|
||||
delete asynccallbackinfo;
|
||||
asynccallbackinfo = nullptr;
|
||||
}
|
||||
delete asynccallbackinfo;
|
||||
asynccallbackinfo = nullptr;
|
||||
},
|
||||
(void *)asynccallbackinfo,
|
||||
&asynccallbackinfo->asyncWork);
|
||||
@@ -702,6 +704,9 @@ napi_value DestroyTimer(napi_env env, napi_callback_info info)
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
AsyncCallbackInfoDestroy *asynccallbackinfo = (AsyncCallbackInfoDestroy *)data;
|
||||
if (asynccallbackinfo == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (asynccallbackinfo->isOK) {
|
||||
for (auto it = asyncCallbackInfoCreateInfo.begin(); it != asyncCallbackInfoCreateInfo.end(); it++) {
|
||||
@@ -726,10 +731,8 @@ napi_value DestroyTimer(napi_env env, napi_callback_info info)
|
||||
ReturnCallbackPromise(env, info, result);
|
||||
|
||||
napi_delete_async_work(env, asynccallbackinfo->asyncWork);
|
||||
if (asynccallbackinfo) {
|
||||
delete asynccallbackinfo;
|
||||
asynccallbackinfo = nullptr;
|
||||
}
|
||||
delete asynccallbackinfo;
|
||||
asynccallbackinfo = nullptr;
|
||||
},
|
||||
(void *)asynccallbackinfo,
|
||||
&asynccallbackinfo->asyncWork);
|
||||
|
||||
Reference in New Issue
Block a user