Hello,

On 06/01/2012 17:24, Jummo wrote:
> Hi,
>
> The duration in the job detail window of BAT does not contain any formatting 
> or description of format and can easily misunderstand.
>
> Sample:
>    Job runtime is 34 minutes and 41 seconds ->  duration is 3146.
>
> With the attached diff the difference between the start time and end time of 
> a job is formated as time and the above example become 00:31:46.
>
> --- bacula-5.2.3_orig/src/qt-console/job/job.cpp        2012-01-06 
> 16:27:35.969779651 +0100
> +++ bacula-5.2.3/src/qt-console/job/job.cpp     2012-01-06 16:28:17.077347819 
> +0100
> @@ -343,7 +343,7 @@
>       char buf[256];
>       QString query =
>          "SELECT JobId, Job.Name, Level, Client.Name, Pool.Name, FileSet,"
> -      "SchedTime, StartTime, EndTime, EndTime-StartTime AS Duration, "
> +      "SchedTime, StartTime, EndTime, TIMEDIFF(EndTime,StartTime) AS 
> Duration, "
>          "JobBytes, JobFiles, JobErrors, JobStatus, PurgedFiles "
>          "FROM Job JOIN Client USING (ClientId) "
>            "LEFT JOIN Pool ON (Job.PoolId = Pool.PoolId) "
>

I suspect that this operation is database dependent. Not sure that 
MySQL, PostgreSQL and SQLITE3 support this operator (correct me if I'm 
wrong).

This is even very likely that the result of the "EndTime - StartTime" 
will depend on the SQL engine (not very good). On postgres and SQLite, 
it should give what you expect directly, and on MySQL you probably have 
to tweak the output as you propose.

A better fix would be to retrieve the two dates, convert them from ISO 
to unix time, do the substract, then use some function (Bacula or QT) to 
convert this amount of seconds to something readable.

This code is probably already available somewhere in Bacula, if not QT 
has also probably a good amount of tool for such kind of date 
manipulation operation.

The patch would be accepted in this way.

Bye

-- 
Need professional help and support for Bacula ?
Visit http://www.baculasystems.com

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Bacula-devel mailing list
Bacula-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-devel

Reply via email to