Mercurial > hg > ltpda
view m-toolbox/m/gui/ltpdv/callbacks/ltpdv_server_set_duration.m @ 46:ca0b8d4dcdb6 database-connection-manager
Fix
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Tue, 06 Dec 2011 19:07:27 +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));