6: Reading buffers 2470 High Voltage SourceMeter Instrument
6-30 2470-901-01 Rev. A / May 2019
Reading buffer time and date values
Time and date values are represented as a number of UTC seconds since 12:00 a.m. Jan. 1, 1970.
Use the following TSP commands to return values in the following formats:
• Hours and minutes: bufferVar.times (on page 14-38)
• UTC seconds: bufferVar.seconds (on page 14-30)
• Month, day, year, format, or to access the timestamp table: bufferVar.dates (on page 14-20)
For example, to return the hours and minutes of the readings in defbuffer1, send the command:
printbuffer(1, 5, defbuffer1.times)
The return is similar to:
20:30:16, 20:30:16, 20:30:16, 20:30:16, 20:30:16
Reading buffer for . . . do loops
The following TSP examples illustrate the use of for . . . do loops when recalling data from a
reading buffer called mybuffer. The following code may be sent as one command line or as part of a
s
cript. Example outputs follow the line of code. Also see the printbuffer() (on page 14-100
) command.
This example loop uses the printbuffer() command to show the reading, units, and relative
t
imestamps for all readings stored in the reading buffer. The information for each reading (reading,
units, and relative timestamps) is shown on a single line with the elements comma-delimited.
for x = 1, mybuffer.n do
printbuffer(x, x, mybuffer, mybuffer.units, mybuffer.relativetimestamps)
end
Example comma-delimited output of above code:
-1.5794739960384e-09, Amp DC, 0
-1.5190692453926e-11, Amp DC, 0.411046134
-2.9570144943758e-11, Amp DC, 0.819675745
-2.9361919146043e-11, Amp DC, 1.228263492
-3.0666566508408e-11, Amp DC, 1.636753752
-4.0868204653766e-11, Amp DC, 2.034403917