function out = hSetTimeName(in, name)
%Helper to set the time dimension for a timetable since this
%   cannot be done on construction and we don't yet support timetable
%   subsasgn.
%   
%   


%   Copyright 2020-2023 The MathWorks, Inc.

assert(istimetable(in), "hSetTimeName can only be used on timetables");
% Timetable does not yet fully support strings, so convert if necessary.
if isstring(name)
    name = char(name);
end

lp = getLocalPart(in);
lp.Properties.DimensionNames{1} = name;
out = codistributed.pDoBuildFromLocalPart(lp, getCodistributor(in));
end
