logGotoLinsec (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

ALL

Firmware version:

1.00 / 1.00.00


logGotoLinsec will search for an entry in the Datalogger that matches the specified timestamp, and if no match is found, it will select the nearest record (if any). It is possible to specify the search direction as either forward or backward.

 

Note for multithreading application:

There is only 1 global read pointer available for each Datalogger which means that several threads navigating the Datalogger should implement critical sections to avoid problems.

 

 

Input:

linsec : DINT

Timestamp in seconds since 1980-1-1 00:00:00 to search for.

 

forward : BOOL

If true, the function searches forward, if false, it searches backwards.  

 

handle : SYSHANDLE

A handle to the Datalogger to navigate. If not provided, it will work on the flash-based log. Only supported on NX32L with firmware 1.50.00 or newer.

 

Returns: BOOL

True if successful, false if no record to move to (i.e. Datalogger is empty).

 

Declaration:

FUNCTION logGotoLinsec : BOOL;
VAR_INPUT
  linsec : DINT; | Timestamp to search for.
  forward : BOOL; | Direction to search, false is backward, true is forward
  handle : SYSHANDLE;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  success : BOOL;
END_VAR;
 
BEGIN
  ...
  // Position readpointer to the last (newest) record in the Datalogger
  logLast();
  // Search for record
  success:=logGotoLinsec(linsec:=clockTimeToLinsec(year:=2003, month:=5, day:=6, Hour:=8, minute:=46, Second:=39), forward:=false);
  ...
END;
 
END_PROGRAM;