Skip to content

Commit 73283c6

Browse files
committed
introduced flag to indicate abosulte or relative
1 parent 40ce6b8 commit 73283c6

3 files changed

Lines changed: 18 additions & 13 deletions

File tree

Launcher.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ SERVICE_REGISTRATION(Launcher, 1, 0);
6868

6969
/* virtual */ const string Launcher::Initialize(PluginHost::IShell* service)
7070
{
71-
Time relativeTime;
71+
Time time;
7272
Time interval;
7373
string message;
7474
Config config;
@@ -83,8 +83,8 @@ SERVICE_REGISTRATION(Launcher, 1, 0);
8383

8484
if (config.ScheduleTime.IsSet() == true) {
8585

86-
relativeTime = Time(config.ScheduleTime.RelativeTime.Value());
87-
if (relativeTime.IsValid() != true) {
86+
time = Time(config.ScheduleTime.Time.Value());
87+
if (time.IsValid() != true) {
8888
SYSLOG(Trace::Warning, (_T("Time format is wrong")));
8989
}
9090

@@ -100,9 +100,9 @@ SERVICE_REGISTRATION(Launcher, 1, 0);
100100
// Well if we where able to parse the parameters (if needed) we are ready to start it..
101101
_observer.Register(&_notification);
102102

103-
if (relativeTime.IsValid() == true) {
103+
if (time.IsValid() == true) {
104104
Core::Time scheduledTime(Core::Time::Now());
105-
uint64_t timeValueToTrigger = ((relativeTime.Hour() * 60 + relativeTime.Minute()) * 60 + relativeTime.Second()) * 1000;
105+
uint64_t timeValueToTrigger = ((time.Hour() * 60 + time.Minute()) * 60 + time.Second()) * 1000;
106106
scheduledTime.Add(timeValueToTrigger);
107107

108108
PluginHost::WorkerPool::Instance().Schedule(scheduledTime, _activity);

Launcher.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,22 +300,22 @@ class Launcher : public PluginHost::IPlugin {
300300
public:
301301
Schedule()
302302
: Core::JSON::Container()
303-
, RelativeTime()
303+
, Time()
304304
, Interval() {
305-
Add(_T("relativetime"), &RelativeTime);
305+
Add(_T("time"), &Time);
306306
Add(_T("interval"), &Interval);
307307
}
308308
Schedule(const Schedule& copy)
309309
: Core::JSON::Container()
310-
, RelativeTime(copy.RelativeTime)
310+
, Time(copy.Time)
311311
, Interval(copy.Interval) {
312-
Add(_T("relativetime"), &RelativeTime);
312+
Add(_T("time"), &Time);
313313
Add(_T("interval"), &Interval);
314314
}
315315
~Schedule() {
316316
}
317317
public:
318-
Core::JSON::String RelativeTime;
318+
Core::JSON::String Time;
319319
Core::JSON::String Interval;
320320
};
321321

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,15 @@ Plugin to "Launch" linux applications and scripts
6969
{ "option": "-h"}
7070
],
7171
"schedule": {
72-
"relativetime": "06:04.10"
72+
"absoulute": false,
73+
"time": "06:04.10"
7374
}
7475
}
7576
```
76-
Note: If relative time value is "00:00.00"/invalid format/not set, the launcher will ignore the given time and launch the application at the launcher activation time itself.
77+
78+
Note:
79+
1. If field "absolute" is false or not set, it will treat the time as relative
80+
2. If relative time value is "00:00.00"/invalid format/not set, the launcher will ignore the given time and launch the application at the launcher activation time itself.
7781

7882
### How to schedule an application/script to run in an interval
7983

@@ -86,7 +90,8 @@ Note: If relative time value is "00:00.00"/invalid format/not set, the launcher
8690
{ "option": "-h"}
8791
],
8892
"schedule": {
89-
"relativetime": "06:04.10",
93+
"absoulute": false,
94+
"time": "06:04.10",
9095
"interval": "00:40.10"
9196
}
9297
}

0 commit comments

Comments
 (0)