struct timeval t;
gettimeofday(&t, NULL);
- DataPoint d = {TIMEVAL_DIFF(t, g_options.start_time), value};
+ DataPoint d = {TIMEVAL_DIFF(t, *Control_GetStartTime()), value};
//TODO: Set actuator
switch (a->id)
{
{
struct timeval now;
gettimeofday(&now, NULL);
- double current_time = TIMEVAL_DIFF(now, g_options.start_time);
+ double current_time = TIMEVAL_DIFF(now, *Control_GetStartTime());
int id = 0;
double set = 0;
double start_time = 0;
void Control_Unlock() {
pthread_mutex_unlock(&(g_controls.mutex));
+}
+
+const struct timeval* Control_GetStartTime() {
+ return &g_controls.start_time;
}
\ No newline at end of file
extern bool Control_Stop();
extern bool Control_Lock();
extern void Control_Unlock();
+extern const struct timeval* Control_GetStartTime();
#endif
// Set time stamp
struct timeval t;
gettimeofday(&t, NULL);
- d->time_stamp = TIMEVAL_DIFF(t, g_options.start_time);
+ d->time_stamp = TIMEVAL_DIFF(t, *Control_GetStartTime());
// Read value based on Sensor Id
switch (s->id)
{
struct timeval now;
gettimeofday(&now, NULL);
- double current_time = TIMEVAL_DIFF(now, g_options.start_time);
+ double current_time = TIMEVAL_DIFF(now, *Control_GetStartTime());
int id = 0;
double start_time = 0;