Home > classes > @timespan > private > compute_interval.m

compute_interval

PURPOSE ^

COMPUTE_INTERVAL compute the interval of the time span.

SYNOPSIS ^

function ts = compute_interval(ts)

DESCRIPTION ^

 COMPUTE_INTERVAL compute the interval of the time span.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: COMPUTE_INTERVAL compute the interval of the time span.

 CALL:        t1 = compute_interval(t1)

 VERSION:     $Id: compute_interval.m,v 1.1 2007/08/14 13:50:50 ingo Exp $

 HISTORY:     03-08-2007 Diepholz
                 Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function ts = compute_interval(ts)
0002 % COMPUTE_INTERVAL compute the interval of the time span.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: COMPUTE_INTERVAL compute the interval of the time span.
0007 %
0008 % CALL:        t1 = compute_interval(t1)
0009 %
0010 % VERSION:     $Id: compute_interval.m,v 1.1 2007/08/14 13:50:50 ingo Exp $
0011 %
0012 % HISTORY:     03-08-2007 Diepholz
0013 %                 Creation
0014 %
0015 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0016 
0017 
0018 number = abs(ts.start.utc_epoch_milli-ts.end.utc_epoch_milli);
0019 
0020 form = java.text.SimpleDateFormat;
0021 form.setTimeZone(java.util.TimeZone.getTimeZone('UTC'));
0022 
0023 form.applyLocalizedPattern('HH')
0024 num_h = char(form.format(java.util.Date(number)));
0025 
0026 form.applyLocalizedPattern('mm')
0027 num_m = char(form.format(java.util.Date(number)));
0028 
0029 form.applyLocalizedPattern('ss')
0030 num_s = char(form.format(java.util.Date(number)));
0031 
0032 ts.interval = '';
0033 
0034 if ~strcmp(num_h, '00')
0035   ts.interval = [ts.interval num_h ' Hours '];
0036 end
0037 
0038 if ~strcmp(num_m, '00')
0039   ts.interval = [ts.interval num_m ' Minutes '];
0040 end
0041 
0042 if ~strcmp(num_s, '00')
0043   ts.interval = [ts.interval num_s ' Seconds '];
0044 end
0045 
0046 
0047

Generated on Mon 03-Sep-2007 12:12:34 by m2html © 2003