function sys = chgTimeUnit_(sys,newUnits)
% Changes time units without altering system.

% Copyright 1986-2014 The MathWorks, Inc.
sf = tunitconv(sys.TimeUnit,newUnits);
% Rescale system data according to tnew = sf * told
Data = sys.Data_;
for ct=1:numel(Data)
   Data(ct) = scaleTime(Data(ct),sf);
end
sys.Data_ = Data;
% Store new time units (Do not use set.TimeUnit to avoid rescaling the
% stored frequency vector twice in FRD models)
if strcmp(newUnits,'seconds')
   sys.TimeUnit_ = [];
else
   sys.TimeUnit_ = newUnits;
end