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
ddf07233
Commit
ddf07233
authored
Oct 23, 2020
by
chen.weican
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修改内容】增加场景设置中跨天情况下的逻辑处理
【提交人】陈伟灿
parent
b95c510a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
1 deletion
+22
-1
midware/midware/scene/kk_scene_handle.c
midware/midware/scene/kk_scene_handle.c
+22
-1
No files found.
midware/midware/scene/kk_scene_handle.c
View file @
ddf07233
...
...
@@ -914,6 +914,7 @@ int kk_scene_check_condition(const char *sceneId)
time_t
startTime
=
0
,
startTime_m
=
0
;
time_t
endTime
=
0
,
endTime_m
=
0
;
int
duration
=
0
;
int
crossDay
=
0
;
sqlite3_stmt
*
stmt
;
kk_scene_ctx_t
*
ctx
=
_kk_scene_get_ctx
();
time_t
current
=
HAL_GetTime
();
...
...
@@ -925,17 +926,37 @@ int kk_scene_check_condition(const char *sceneId)
repeatday
=
sqlite3_column_int
(
stmt
,
DB_SCENECONDITION_REPEATDAY
);
startTime
=
sqlite3_column_int
(
stmt
,
DB_SCENECONDITION_STARTTIME
);
endTime
=
sqlite3_column_int
(
stmt
,
DB_SCENECONDITION_ENDTIME
);
crossDay
=
sqlite3_column_int
(
stmt
,
DB_SCENECONDITION_CROSSDAY
);
duration
=
endTime
-
startTime
;
startTime_m
=
kk_scene_creat_new_starttime
(
startTime
,
current
);
INFO_PRINT
(
"current:%ld,startTime_m:%ld,repeatday:%d
\n
"
,
current
,
startTime_m
,
repeatday
);
/********check today is one of repeatday**************/
if
((
repeatday
>
0
)
&&
(
repeatday
&
(
1
<<
(
curWeek
-
1
)))){
if
(
current
>=
startTime_m
&&
current
<=
(
startTime_m
+
duration
)){
if
(
crossDay
&&
current
<
startTime_m
){
/*跨天处理,判断当前时间是否在上一天的结束时间内*/
if
(
current
<=
(
startTime_m
+
duration
-
86400
)){
res
=
SUCCESS_RETURN
;
}
}
else
if
(
current
>=
startTime_m
&&
current
<=
(
startTime_m
+
duration
)){
res
=
SUCCESS_RETURN
;
}
else
{
INFO_PRINT
(
"time not match current:%ld,startTime_m:%ld,repeatday:%d
\n
"
,
current
,
startTime_m
,
repeatday
);
}
}
else
if
((
repeatday
>
0
)
&&
(
!
(
repeatday
&
(
1
<<
(
curWeek
-
1
))))){
/*跨天处理,获取前一天的星期*/
if
(
crossDay
==
1
){
curWeek
=
(
curWeek
-
1
)
==
0
?
7
:
(
curWeek
-
1
);
/*前一天的星期必须要在重复星期内*/
if
(
repeatday
&
(
1
<<
(
curWeek
-
1
))){
if
(
current
<=
(
startTime_m
+
duration
-
86400
)){
res
=
SUCCESS_RETURN
;
}
}
}
}
else
{
if
(
current
>=
startTime
&&
current
<=
(
startTime
+
duration
)){
...
...
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