typedef struct ControlData {
ControlModes current_mode;
pthread_mutex_t mutex;
- struct timeval start_time;
+ struct timespec start_time;
char user_name[31]; // The user who owns the currently running experiment
char experiment_dir[BUFSIZ]; //Directory for experiment
char experiment_name[BUFSIZ];
return;
}
- if (strcmp(g_controls.user_name, context->user_name) != 0)
+ if ((*g_controls.user_name) != '\0' && strcmp(g_controls.user_name, context->user_name) != 0)
{
if (context->user_type != USER_ADMIN) {
FCGI_RejectJSON(context, "Another user has an experiment in progress.");
path, strerror(errno));
ret = "Couldn't create experiment directory.";
} else {
- gettimeofday(&(g_controls.start_time), NULL);
+ clock_gettime(CLOCK_MONOTONIC, &(g_controls.start_time));
}
} else
ret = "Cannot start when not in a stopped state.";
* Gets the start time for the current experiment
* @return the start time
*/
-const struct timeval* Control_GetStartTime() {
+const struct timespec * Control_GetStartTime() {
return &g_controls.start_time;
}