* be moved *forward* in the queue) */
if (jprev == NULL || line->cl_nextexe < jprev->j_line->cl_nextexe) {
j = queue_base;
+ jprev = NULL;
}
else {
j = jprev;
else
lavg_entry->l_until = (line->cl_until > 0) ? now + line->cl_until : 0;
+ if (debug_opt) {
+ if (lavg_entry->l_until == 0) {
+ send_msg_fd_debug(info_fd,
+ " lavg entry added until:none cmd: '%s'",
+ line->cl_shell);
+ }
+ else {
+ struct tm ftime;
+ struct tm *ft = localtime(&(lavg_entry->l_until));
+
+ /* localtime() returns a statically allocated struct which might be
+ overwritten by subsequent calls: take a copy.
+ (note: localtime() is used in the debug() function too) */
+ memcpy(&ftime, ft, sizeof(struct tm));
+
+ send_msg_fd_debug(info_fd,
+ " lavg entry added until:%04d-%02d-%02d "
+ "%02d:%02d:%02d (system time) cmd: '%s'",
+ (ftime.tm_year + 1900), (ftime.tm_mon + 1),
+ ftime.tm_mday, ftime.tm_hour,
+ ftime.tm_min, ftime.tm_sec, line->cl_shell);
+ }
+ }
+
}
ft = localtime(&(line->cl_nextexe));
- /* localtime() function seem to return every time the same pointer :
- * it resets our previous changes, so we need to prevent it
- * ( localtime() is used in the debug() function) */
+ /* localtime() returns a statically allocated struct which might be
+ * overwritten by subsequent calls: take a copy.
+ * (note: localtime() is used in the debug() function too) */
memcpy(&ftime, ft, sizeof(struct tm));
send_msg_fd_debug(info_fd,