view m-toolbox/m/gui/ltpdv/callbacks/ltpdv_server_set_duration.m @ 52:daf4eab1a51e database-connection-manager tip

Fix. Default password should be [] not an empty string
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:29:47 +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));