1 nsec options – Campbell Scientific CR800 and CR850 Measurement and Control Systems User Manual
Page 225

Section 7. Installation
225
• Placing a time stamp in a second position in a record.
• Accessing a time stamp from a data table and subsequently storing it as part
of a larger data table. Maximum(), Minimum(), and FileTime() instructions
produce a time stamp that may be accessed from the program after being
written to a data table. The time of other events, such as alarms, can be stored
using the RealTime() instruction.
• Accessing and storing a time stamp from another datalogger in a PakBus
network.
7.8.10.1 NSEC Options
NSEC is used in a CRBasic program one of the following three ways. In all
cases, the time variable is only sampled with a Sample() instruction,
Reps
=
1
.
1. Time variable is declared As Long. Sample() instruction assumes the time
variable holds seconds since 1990 and microseconds into the second is 0. The
value stored in final data storage is a standard time stamp. See CRBasic
example NSEC — One Element Time Array
(p. 225).
2. Time-variable array dimensioned to (2) and As Long — Sample() instruction
assumes the first time variable array element holds seconds since 1990 and the
second element holds microseconds into the second. See CRBasic example
NSEC — Two Element Time Array
(p. 226).
3. Time-variable array dimensioned to (7) or (9) and As Long or As Float —
Sample() instruction assumes data are stored in the variable array in the
sequence year, month, day of year, hour, minutes, seconds, and milliseconds.
See CRBasic example NSEC — Seven and Nine Element Time Arrays
(p. 226).
CRBasic example NSEC — Convert Time Stamp to Universal Time
(p. 225)
shows
one of several practical uses of the NSEC data type.
CRBasic Example 43. NSEC — One Element Time Array
'A time stamp is retrieved into variable TimeVar(1) as seconds since 00:00:00
'1 January 1990. Because the variable is dimensioned to 1, NSEC assumes the value =
'seconds since 00:00:00 1 January 1990.
'Declarations
Public
PTemp
Public
TimeVar(1)
As Long
DataTable
(FirstTable,True,-1)
DataInterval
(0,1,Sec,10)
Sample
(1,PTemp,FP2)
EndTable
DataTable
(SecondTable,True,-1)
DataInterval
(0,5,Sec,10)
Sample
(1,TimeVar,Nsec)
EndTable