view m-toolbox/m/gui/ltpdv/callbacks/ltpdv_server_get_start_time.m @ 24:056f8e1e995e database-connection-manager

Properly record history in fromRepository constructors
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 gps = ltpdv_server_get_start_time(mainfig)

% Handle
sh = findobj(mainfig, 'Tag', 'LTPDVserverStartEdit');

% Get string
sstr = get(sh, 'String');


if sstr(1) == '+'
   % get start
   start = ltpdv_server_get_stop_time(mainfig);
   gps = start + str2num(sstr(2:end)) -1;
   set(sh, 'String', GPS2UTC(gps));
   return
end
if sstr(1) == '-'
   % get start
   start = ltpdv_server_get_stop_time(mainfig);
   gps = start - str2num(sstr(2:end)) +1;
   set(sh, 'String', GPS2UTC(gps));
   return
end

% Is this GPS?
if ~isempty(sstr)
   try
      gps = eval(sstr);
      utc = GPS2UTC(gps);
   catch
      utc = sstr;
      gps = UTC2GPS(utc);
   end
else
   gps = -1;
end