Home > matlab > dynsec2hms.m

dynsec2hms

PURPOSE ^

DYNSEC2HMS Converts a number of seconds into a hours-minutes-seconds string

SYNOPSIS ^

function hms = dynsec2hms(secs)

DESCRIPTION ^

 DYNSEC2HMS Converts a number of seconds into a hours-minutes-seconds string

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function hms = dynsec2hms(secs)
0002 % DYNSEC2HMS Converts a number of seconds into a hours-minutes-seconds string
0003 
0004 % Copyright (C) 2008-2009 Dynare Team
0005 %
0006 % This file is part of Dynare.
0007 %
0008 % Dynare is free software: you can redistribute it and/or modify
0009 % it under the terms of the GNU General Public License as published by
0010 % the Free Software Foundation, either version 3 of the License, or
0011 % (at your option) any later version.
0012 %
0013 % Dynare is distributed in the hope that it will be useful,
0014 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0015 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0016 % GNU General Public License for more details.
0017 %
0018 % You should have received a copy of the GNU General Public License
0019 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0020 
0021 secs = round(secs);
0022 s = rem(secs, 60);
0023 m = rem(floor(secs / 60), 60);
0024 h = floor(secs / 3600);
0025 hms = sprintf('%dh%02dm%02ds', h, m, s);

Generated on Mon 21-May-2012 02:42:43 by m2html © 2005