Specifications

Section 11. Programming Resource Library
11-36
11.11 Programming for Control
This section is not yet available.
11.12 NSEC Data Type
11.12.1 NSEC Application
NSEC data type consists of 8 bytes divided up as 4 bytes of seconds since 1990
and 4 bytes of nanoseconds into the second. NSEC is used when a LONG
variable being sampled is the result of the RealTime() instruction, or when the
sampled variable is a LONG storing time since 1990, such as results when
time-of-maximum or time-of-minimum is requested.
Specific uses include:
Placing a timestamp in a second position in a record.
Accessing a timestamp from a data table and subsequently storing it as part
of a larger data table. Maximum(), Minimum, and FileTime() instructions
produce a timestamp 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 timestamp from another datalogger in a PakBus
network.
11.12.2 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 Sample() instruction reps = 1.
Time variable dimensioned to (1). If the variable array (must be LONG) is
dimensioned to 1, the instruction assumes that the variable holds seconds
since 1990 and microseconds into the second is 0. In this instance, the
value stored is a standard datalogger timestamp rather than the number of
seconds since January 1990. EXAMPLE 11.12-1 shows NSEC used with
a tim
e variable array of (1).
Time variable dimensioned to (2). If the variable array (must be LONG) is
dimensioned to two, the instruction assumes that the first element holds
seconds since 1990 and the second element holds microseconds into the
second. EXAMPLE 11.12-2 shows NSEC used with a time variable array
o
f (2).
Time variable dimensioned to (7). If the variable array (must be FLOAT
or LONG) is dimensioned to 7, and the values stored are year, month, day
of year, hour, minutes, seconds, and milliseconds. EXAMPLE 11.12-3
sh
ows NSEC used with a time variable array of (7).