View Raw SPL
/****************************************************************************
* *
* GETXTIME.SPL Copyright 2010 (C) DSP Development Corporation *
* *
* Author: Randy Race *
* *
* Synopsis: Returns X coordinates as time values *
* *
* Revisions: 12 Apr 2010 RRR Creation *
* *
****************************************************************************/
#include
#if @HELP_GETXTIME
GETXTIME
Purpose: Returns the x-axis coordinate range of a Window as time values.
Syntax: GETXTIME(window)
(xltime, xrtime) = GETXTIME(window)
window - Optional. Window reference. Defaults to the current
Window.
Returns: A string. The left hand time value of the displayed data.
(xltime, xrtime) = GETXTIME(window) returns both the left
and right time strings.
Example:
W1:gnorm(1000, 1);settime("8:00");sethunits("time");
setxtime(W1, "8:05", "8:10");
creates a 1000 point series with horizontal time units of
Time. The starting time is 8:00. The X axis is set to
display data between 8:05 and 8:10. The left and right
time strings of the displayed data are returned.
Remarks:
The horizontal units of the series must be a time unit
such as Time or Real Time.
See SETXTIME to set the x-axis coordinates in time values.
See GETXL and GETXR to return the x-axis coordinates in
terms of the delta-x between values.
See Also:
GETXL
GETXR
GETXDATE
SETX
SETHUNITS
SETXDATE
SETXTIME
#endif
/* get x axis values as time strings */
getxtime(win)
{
local xl, xr, time_offset;
if (argc < 1)
{
win = refwin(w0);
}
time_offset = todmsecstr(gettime(win));
xl = getxl(win);
xr = getxr(win);
xl = strtodmsec(xl + time_offset);
xr = strtodmsec(xr + time_offset);
if (outargc > 1)
{
return(xl, xr);
}
else
{
return(xl);
}
}