Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libmtime
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
icon-libraries
libmtime
Commits
731733bc
Commit
731733bc
authored
11 years ago
by
Rahul Sinha
Browse files
Options
Downloads
Patches
Plain Diff
Feature
parent
bac9e61e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mtime_eventHandling.c
+18
-4
18 additions, 4 deletions
src/mtime_eventHandling.c
with
18 additions
and
4 deletions
src/mtime_eventHandling.c
+
18
−
4
View file @
731733bc
...
...
@@ -539,6 +539,7 @@ deallocateEvent(struct _event* e)
/* INTERNAL FUNCTION. */
//Get if trigger is true. Trigger true in [T-allowedMinusdelta,T+allowedPlusdelta].
static
compare_return_val
isTriggerTimeInRange
(
struct
_datetime
*
current_dt
,
struct
_datetime
*
triggerNextEventDateTime
,
struct
_timedelta
*
allowedPlusdelta
,
struct
_timedelta
*
allowedMinusdelta
)
...
...
@@ -580,7 +581,7 @@ isTriggerTimeInRange(struct _datetime* current_dt, struct _datetime* triggerNext
deallocateDateTime
(
dt_upperbound
);
deallocateDateTime
(
dt_lowerbound
);
}
else
/* If
alloweddelta is not defined or
is malformed (negative sign is not permitted), return as normal (follow exact match for equal). */
else
/* If
slack
is malformed (negative sign is not permitted), return as normal (follow exact match for equal). */
{
cmp_val_flag
=
compareDatetime
(
current_dt
,
triggerNextEventDateTime
);
}
...
...
@@ -592,7 +593,9 @@ isTriggerTimeInRange(struct _datetime* current_dt, struct _datetime* triggerNext
/**
* @brief Check if this event is active by comparing event's trigger time with current_dt.
*
* The current_dt must EXACTLY match event's trigger time. The lib has no builtin clock but relies on isCurrentEventActive(.)
* The current_dt must EXACTLY match event's trigger time
* (subject to optional specified slack: [Trigger_time - minus_slack, Trigger_time + plus_slack]. Slacks can be NULL. Always inclusive.)
* The lib has no builtin clock but relies on isCurrentEventActive(.)
* being called (polled) from the application at fixed interals.
*
* @param event
...
...
@@ -601,12 +604,18 @@ isTriggerTimeInRange(struct _datetime* current_dt, struct _datetime* triggerNext
* @param current_dt
* A pointer to struct _datetime. This is the 'current' datetime of the system.
*
* @param plus_slack
* A pointer to struct _timedelta. Events are triggered between [actual_trigger_time, actual_trigger_time + plus_slack].
* Can be NULL; logically 0. Sign MUST be '+'
*
* @param minus_slack
* A pointer to struct _timedelta. Events are triggered between [actual_trigger_time - minus_slack, actual_trigger_time].
* Can be NULL; logically 0. Sign MUST be '+'
*
* @return bool
* true/false indicating if the event is active.
*/
//bool
//isCurrentEventActive(struct _event* event, struct _datetime* current_dt, struct _timedelta* allowed_slack, struct _timedelta* add_slack, struct _timedelta* substract_slack)
bool
isCurrentEventActive
(
struct
_event
*
event
,
struct
_datetime
*
current_dt
,
struct
_timedelta
*
plus_slack
,
struct
_timedelta
*
minus_slack
)
{
...
...
@@ -623,6 +632,9 @@ isCurrentEventActive(struct _event* event, struct _datetime* current_dt, struct
int
cmp_val_flag
=
-
128
;
/* Make a local copy of slack to avoid updating the user supplied timedeltas. */
struct
_timedelta
*
plus_slack_local
=
NULL
;
struct
_timedelta
*
minus_slack_local
=
NULL
;
if
(
plus_slack
)
...
...
@@ -635,6 +647,8 @@ isCurrentEventActive(struct _event* event, struct _datetime* current_dt, struct
else
minus_slack_local
=
newTimeDelta
(
initDummyTDString
);
/* In case the current_dt starts ahead of event->triggerNextEventDateTime, we need to update the event->triggerNextEventDateTime
to the next possible trigger time or else the events will never trigger. */
if
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment