View Raw SPL
/*****************************************************************************
* *
* ISRT.SPL Copyright (C) 2012 DSP Development Corporation *
* All Rights Reserved *
* *
* Author: Randy Race *
* *
* Synopsis: Returns 1 if input is a series real time X units *
* *
* Revisions: 10 Apr 2012 RRR Creation *
* *
*****************************************************************************/
#if @HELP_ISRT
ISRT
Purpose: Returns 1 if the input is a series with real time X units.
Syntax: ISRT(val)
val - A series, scalar or string input.
Returns: 1 if the input is a series with date/time X units, else 0.
Example:
s1 = grand(100, 1);sethunits("time");
s2 = grand(100, 1);sethunits("real time");
s3 = grand(100, 1);sethunits("seconds");
isrt(s1) == 1
isrt(s2) == 1
isrt(s3) == 0
Both "time" and "real time" are considered real time units such
that the actual clock time is displayed on the X axis, but
"seconds" is not considered a real time unit.
Example:
isrt(3)
returns 0
Remarks:
A series with "real time" or "time" X units displays tic values
in terms of actual clock time. The starting date and time is
determined by the series start date and start time.
See SETDATE and SETTIME to set the series date and time.
If the input is not a series, ISRT returns 0.
See Also:
isdt
setdate
sethunits
settime
units
#endif
/* is series a real time series (has real time X units) */
isrt(s)
{
local status = 0;
if (argc < 1) s = refwin(w0);
if (isarray(s) && length(s) > 0)
{
switch (gethunits(s))
{
case "Real Time":
case "Time":
status = 1;
break;
default:
break;
}
}
return(status == 1);
}