SR Research Support Site
Macros | Functions
Access Tracker Time

Macros

#define eyelink_tracker_time()   eyelink_tracker_msec()
 
#define eyelink_time_offset()   eyelink_msec_offset()
 

Functions

UINT32 eyelink_request_time (void)
 
UINT32 eyelink_node_request_time (ELINKADDR node)
 
UINT32 eyelink_read_time (void)
 
double eyelink_tracker_double_usec (void)
 
UINT32 eyelink_tracker_msec (void)
 
double eyelink_double_usec_offset (void)
 
UINT32 eyelink_msec_offset (void)
 

Detailed Description

These function produce a local estimate of the eye tracker clock. There are several time bases in the system: the eye tracker time, the local eyelink DLL time, and the OS system time. All of these may not run at the same speed, differing by up to 200 ppm (2 milliseconds every 10 seconds).

These functions give a reasonable estimate of the EyeLink tracker time that is used in EDF files and for sample and event timestamps over the link. The time estimate is perturbed by link delays, but will never decrease, but may jump forwards sometimes or "freeze" for a few milliseconds. Two resolution of time are given: milliseconds as returned by current_time(), and microseconds as returned by current_double_usec().

Macro Definition Documentation

#define eyelink_time_offset ( )    eyelink_msec_offset()
#define eyelink_tracker_time ( )    eyelink_tracker_msec()

Function Documentation

double eyelink_double_usec_offset ( void  )

Returns the time difference between the tracker time and display pc time.

Returns
Returns the time difference between the tracker time and display pc time in microseconds.
See also
current_time() and eyelink_tracker_msec()
UINT32 eyelink_msec_offset ( void  )

Returns the time difference between the tracker time and display pc time.

Returns
Returns the time difference between the tracker time and display pc time.
See also
current_time(), eyelink_tracker_msec() and eyelink_tracker_double_usec()
UINT32 eyelink_node_request_time ( ELINKADDR  node)

Sends a request the connected eye tracker to return its current time.

Remarks
The time reply can be read with eyelink_read_time().
Parameters
nodeAddress of a specific tracker.
Returns
0 if no error, else link error code.

Example: See eyelink_request_time()

See also
eyelink_request_time() and eyelink_read_time()
UINT32 eyelink_read_time ( void  )

Returns the tracker time requested by eyelink_request_time() or eyelink_node_request_time().

Returns
0 if no response yet, else timestamp in millisecond.

Example: See eyelink_request_time()

See also
eyelink_node_request_time() and eyelink_request_time()
UINT32 eyelink_request_time ( void  )

Sends a request the connected eye tracker to return its current time.

Remarks
The time reply can be read with eyelink_read_time().
Returns
0 if no error, else link error code.

Example:

1 // This program illustrates the use of eyelink_request_time to retrieve the current tracker time
2 
3 #include <eyelink.h>
4 
5 // This routine is used to retrieve the concurrent tracker PC time.
6 // If successful, this function returns the tracker PC time, else 0;
7 // Note, the waiting time is set as 50 msec, although normally the function should return within 1 msec
8 UINT32 current_tracker_time()
9 {
10  UINT32 time_subject=0, time_tracker=0;
11 
12  eyelink_request_time(); // request the tracker PC time
13  time_subject = current_msec();
14  // wait for a maximum of 50 msec
15  while(!time_tracker && current_msec() -time_subject < 50)
16  time_tracker = eyelink_read_time(); // read tracker PC time
17 
18  return time_tracker;
19 }
See also
eyelink_node_request_time() and eyelink_read_time()
double eyelink_tracker_double_usec ( void  )

Returns the current tracker time (in micro seconds) since the tracker application started.

Returns
Each of these functions returns the current tracker time (in microseconds) since tracker initialization.

Example:

1 // This program illustrates the use of eyelink_tracker_double_usec()
2 #include <eyelink.h>
3 #include <stdio.h>
4 
5 int i;
6 ALLF_DATA evt;
7 
8 i = eyelink_get_next_data(NULL); // Checks for new data item
9 switch(i)
10 {
11  case SAMPLE_TYPE:
12  {
13  // Gets the new data
14  eyelink_get_float_data(&evt);
15  // Checks for the difference of the current tracker time and the
16  // time returned from the latest sample
17  if(eyelink_tracker_double_usec()/1000000 >(evt.time +2) )
18  printf("Oops it took longer than 2 milliseconds for the data to get
19  here.\n");
20  }
21  break;
22 }
See also
eyelink_tracker_msec(), current_time(), eyelink_msec_offset() and eyelink_double_usec_offset()
UINT32 eyelink_tracker_msec ( void  )

Returns the current tracker time (in milliseconds) since the tracker application started.

Returns
Each of these functions returns the current tracker time (in microseconds) since tracker initialization.

Example:

1 // This program illustrates the use of eyelink_tracker_time()
2 #include <eyelink.h>
3 #include <stdio.h>
4 
5 int i;
6 ALLF_DATA evt;
7 
8 i = eyelink_get_next_data(NULL); // Checks for new data item
9 switch(i)
10 {
11  case SAMPLE_TYPE:
12  {
13  // Gets the new data
14  eyelink_get_float_data(&evt);
15  // Checks for the difference of the current tracker time and the
16  // time returned from the latest sample
17  if(eyelink_tracker_msec()/1000 >(evt.time +2) )
18  printf("Oops it took longer than 2 milliseconds for the data to get
19  here.\n");
20  }
21  break;
22 }
See also
current_time(), eyelink_msec_offset(), eyelink_double_usec_offset() and eyelink_tracker_double_usec()

Copyright ©2002-2021, SR Research Ltd.