All the jobs that are canceled while they are still in the run queue (duplicate)
are not reporting the start time correctly.
Example:
Scheduled time: 10-Dec-2020 13:15:01
Start time: 01-Jan-1970 01:00:00
End time: 10-Dec-2020 13:15:01
Elapsed time: 50 years 11 months 26 days 13 hours 15 mins 1 sec
The fix will display an empty start time
Scheduled time: 10-Dec-2020 13:15:01
Start time:
End time: 10-Dec-2020 13:15:01
Elapsed time: 1 sec
sprintf(term_code, _("Inappropriate term code: %c\n"), jcr->JobStatus);
break;
}
- bstrftimes(schedt, sizeof(schedt), jcr->jr.SchedTime);
- bstrftimes(sdt, sizeof(sdt), jcr->jr.StartTime);
- bstrftimes(edt, sizeof(edt), jcr->jr.EndTime);
+ bstrftimes_na(schedt, sizeof(schedt), jcr->jr.SchedTime);
+ bstrftimes_na(sdt, sizeof(sdt), jcr->jr.StartTime);
+ bstrftimes_na(edt, sizeof(edt), jcr->jr.EndTime);
Jmsg(jcr, msg_type, 0, _("Bacula " VERSION " (" LSMDATE "): %s\n"
Mmsg(term_msg, _("Inappropriate term code: %c\n"), jcr->JobStatus);
break;
}
- bstrftimes(schedt, sizeof(schedt), jcr->jr.SchedTime);
- bstrftimes(sdt, sizeof(sdt), jcr->jr.StartTime);
- bstrftimes(edt, sizeof(edt), jcr->jr.EndTime);
+ bstrftimes_na(schedt, sizeof(schedt), jcr->jr.SchedTime);
+ bstrftimes_na(sdt, sizeof(sdt), jcr->jr.StartTime);
+ bstrftimes_na(edt, sizeof(edt), jcr->jr.EndTime);
RunTime = jcr->jr.EndTime - jcr->jr.StartTime;
- if (RunTime <= 0) {
+ if (jcr->jr.StartTime == 0 || RunTime <= 0) {
RunTime = 1;
}
kbps = ((double)jcr->jr.JobBytes) / (1000.0 * (double)RunTime);
}
Mmsg(term_code, term_msg.c_str(), jcr->get_OperationName(), jcr->get_ActionName(0));
- bstrftimes(sdt, sizeof(sdt), jcr->jr.StartTime);
- bstrftimes(edt, sizeof(edt), jcr->jr.EndTime);
+ bstrftimes_na(sdt, sizeof(sdt), jcr->jr.StartTime);
+ bstrftimes_na(edt, sizeof(edt), jcr->jr.EndTime);
RunTime = jcr->jr.EndTime - jcr->jr.StartTime;
- if (RunTime <= 0) {
+ if (jcr->jr.StartTime == 0 || RunTime <= 0) {
RunTime = 1;
}
kbps = (double)jcr->SDJobBytes / (1000.0 * (double)RunTime);
sprintf(term_code, _("Inappropriate term code: %c\n"), TermCode);
break;
}
- bstrftimes(sdt, sizeof(sdt), jcr->jr.StartTime);
- bstrftimes(edt, sizeof(edt), jcr->jr.EndTime);
+ bstrftimes_na(sdt, sizeof(sdt), jcr->jr.StartTime);
+ bstrftimes_na(edt, sizeof(edt), jcr->jr.EndTime);
RunTime = jcr->jr.EndTime - jcr->jr.StartTime;
- if (RunTime <= 0) {
+ if (jcr->jr.StartTime == 0 || RunTime <= 0) {
RunTime = 1;
}
kbps = (double)jcr->jr.JobBytes / (1000.0 * (double)RunTime);
_("Inappropriate term code: %d %c\n"), TermCode, TermCode);
break;
}
- bstrftimes(sdt, sizeof(sdt), jcr->jr.StartTime);
- bstrftimes(edt, sizeof(edt), jcr->jr.EndTime);
+ bstrftimes_na(sdt, sizeof(sdt), jcr->jr.StartTime);
+ bstrftimes_na(edt, sizeof(edt), jcr->jr.EndTime);
RunTime = jcr->jr.EndTime - jcr->jr.StartTime;
+ if (jcr->jr.StartTime == 0 || RunTime <= 0) {
+ RunTime = 1;
+ }
if (jcr->verify_job) {
Name = jcr->verify_job->hdr.name;
} else {
return dt;
}
+char *bstrftimes_na(char *dt, int maxlen, utime_t utime)
+{
+ if (utime == 0) {
+ return bstrncpy(dt, "", maxlen);
+ } else {
+ return bstrftimes(dt, maxlen, utime);
+ }
+}
+
/* Formatted time for user display: dd-Mon-yyyy hh:mm:ss */
char *bstrftimes(char *dt, int maxlen, utime_t utime)
{
char *bstrftime_dn(char *dt, int maxlen, utime_t tim);
char *bstrftime_c(char *dt, int maxlen, utime_t utime);
utime_t str_to_utime(char *str);
+char *bstrftimes_na(char *dt, int maxlen, utime_t utime);
/* =========================================================== */