view m-toolbox/m/gui/ltpdv/callbacks/ltpdv_server_set_duration.m @ 10:75007001cbfe database-connection-manager

Check for binary only objects
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

function ltpdv_server_set_duration(mainfig, start, stop)

% Get handle
dh = findobj(mainfig, 'Tag', 'LTPDVserverDurationDisplay');

% Get duration
dur = stop - start + 1;

if dur < 0
  error('### The duration is negative. Change the start or stop time.');
end

hours = fix(dur/3600);
mins  = fix((dur-hours*3600)/60);
secs  = dur-hours*3600-mins*60;

sign = '';
if hours < 0
   sign = '-';
   hours = abs(hours);
end
if mins < 0
   sign = '-';
   mins = abs(mins);
end
if secs < 0
   sign = '-';
   secs = abs(secs);
end

set(dh, 'String', sprintf('%s%02d:%02d:%02d', sign, hours, mins, secs));