Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
k-sdk
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈伟灿
k-sdk
Commits
aab93033
Commit
aab93033
authored
Sep 02, 2020
by
黄振令
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修改内容】1. 添加获取当前时间秒数;2.网关有数据,更新网关时间
【提交人】huang.zhenling
parent
87d2de68
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1485 additions
and
1469 deletions
+1485
-1469
common/hal/HAL_OS_linux.c
common/hal/HAL_OS_linux.c
+743
-731
midware/midware/dm/kk_dm_msg.c
midware/midware/dm/kk_dm_msg.c
+737
-737
midware/midware/midware.c
midware/midware/midware.c
+5
-1
No files found.
common/hal/HAL_OS_linux.c
View file @
aab93033
...
...
@@ -115,6 +115,18 @@ uint64_t HAL_UptimeMs(void)
return
time_ms
;
}
uint64_t
HAL_GetTimeMs
(
void
)
{
uint64_t
time_ms
;
struct
timespec
ts
;
clock_gettime
(
CLOCK_REALTIME
,
&
ts
);
time_ms
=
((
uint64_t
)
ts
.
tv_sec
*
(
uint64_t
)
1000
)
+
(
ts
.
tv_nsec
/
1000
/
1000
);
return
time_ms
;
}
char
*
HAL_GetTimeStr
(
_IN_
char
*
buf
,
_IN_
int
len
)
{
struct
timeval
tv
;
...
...
midware/midware/dm/kk_dm_msg.c
View file @
aab93033
...
...
@@ -316,7 +316,7 @@ const char DM_MSG_COMBINE_STATUS_ONLINE[] DM_READ_ONLY =
}
/* TimeStamp */
HAL_Snprintf
(
timestamp
,
DM_UTILS_UINT64_STRLEN
,
"%llu"
,
(
unsigned
long
long
)
HAL_
UptimeMs
());
HAL_Snprintf
(
timestamp
,
DM_UTILS_UINT64_STRLEN
,
"%llu"
,
(
unsigned
long
long
)
HAL_
GetTimeMs
());
/* dm_log_debug("Time Stamp: %s", timestamp); */
...
...
@@ -360,7 +360,7 @@ int dm_msg_status_offline(_IN_ char productCode[PRODUCT_CODE_MAXLEN],
}
/* TimeStamp */
HAL_Snprintf
(
timestamp
,
DM_UTILS_UINT64_STRLEN
,
"%llu"
,
(
unsigned
long
long
)
HAL_
UptimeMs
());
HAL_Snprintf
(
timestamp
,
DM_UTILS_UINT64_STRLEN
,
"%llu"
,
(
unsigned
long
long
)
HAL_
GetTimeMs
());
/* dm_log_debug("Time Stamp: %s", timestamp); */
...
...
@@ -406,7 +406,7 @@ int dm_msg_combine_login(_IN_ char productCode[PRODUCT_CODE_MAXLEN],
}
/* TimeStamp */
HAL_Snprintf
(
timestamp
,
DM_UTILS_UINT64_STRLEN
,
"%llu"
,
(
unsigned
long
long
)
HAL_
UptimeMs
());
HAL_Snprintf
(
timestamp
,
DM_UTILS_UINT64_STRLEN
,
"%llu"
,
(
unsigned
long
long
)
HAL_
GetTimeMs
());
/* dm_log_debug("Time Stamp: %s", timestamp); */
/* Client ID */
...
...
@@ -543,7 +543,7 @@ int dm_msg_request (_IN_ dm_msg_request_t *request)
}
memset
(
payload
,
0
,
payload_len
);
snprintf
(
payload
,
payload_len
,
DM_MSG_REQUEST
,
request
->
msgid
,
DM_MSG_VERSION
,
request
->
params
,
HAL_
UptimeMs
(),
request
->
method
);
DM_MSG_VERSION
,
request
->
params
,
HAL_
GetTimeMs
(),
request
->
method
);
req_info_len
=
strlen
(
DM_MSG_INFO
)
+
10
+
strlen
(
request
->
productCode
)
+
strlen
(
request
->
deviceCode
)
+
strlen
(
request
->
msgTypeStr
)
+
1
;
req_info
=
malloc
(
req_info_len
);
...
...
midware/midware/midware.c
View file @
aab93033
...
...
@@ -180,7 +180,7 @@ void kk_platMsg_handle(void* data, char* chalMark){
info
=
cJSON_GetObjectItem
(
json
,
"info"
);
payload
=
cJSON_GetObjectItem
(
json
,
"payload"
);
if
(
info
==
NULL
||
payload
==
NULL
){
ERROR_PRINT
(
"info or payload params
is
error
\n
"
);
ERROR_PRINT
(
"info or payload params error
\n
"
);
goto
error
;
}
...
...
@@ -194,6 +194,10 @@ void kk_platMsg_handle(void* data, char* chalMark){
goto
error
;
}
if
(
chalMark
!=
NULL
){
dm_mgr_update_timestamp_by_devicecode
(
chalMark
,
HAL_UptimeMs
());
}
dm_mgr_update_timestamp_by_devicecode
(
info_dcode
->
valuestring
,
HAL_UptimeMs
());
if
(
strcmp
(
msgType
->
valuestring
,
"/thing/topo/add"
)
==
0
){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment