SR Research Support Site
Data Structures | Macros | Functions
Access Local Time

Data Structures

struct  MICRO
 

Macros

#define current_msec()   current_time()
 

Functions

UINT32 current_time (void)
 
UINT32 current_micro (MICRO FARTYPE *m)
 
UINT32 current_usec (void)
 
void msec_delay (UINT32 n)
 
double current_double_usec (void)
 
INT16 eyelink_reset_clock (INT16 enable)
 

Detailed Description

These functions are used to access display time

Macro Definition Documentation

#define current_msec ( )    current_time()

Function Documentation

double current_double_usec ( void  )

Returns the current microsecond as double (56 bits) since the initialization. Equivalent to current_micro() and current_usec().

Returns
The current microsecond as a double value since the initialization of the library, modulo 2^32.

Example: See current_usec()

\sa \c current_micro(), \c current_usec(), \c current_msec(), \c current_time() and \c msec_delay()
UINT32 current_micro ( MICRO FARTYPE *  m)

Returns the current microsecond since the initialization. Equivalent to current_usec() and current_double_usec().

Parameters
mPointer to MICRO structure.
Returns
The current microsecond since the initialization of the library, modulo 2^32. It can also fill in the MICRO structure if the pointer is not NULL.

Example: See current_usec()

See also
current_usec(), current_double_usec(), current_msec(), current_time() and msec_delay()
UINT32 current_time ( void  )

Returns the current millisecond since the initialization.

Remarks
If the eyelink_exptkit library is not initialized, or initialized multiple times, the return value is invalid and the return value is unpredictable. So in order to avoid this, make sure that close_eyelink_system() is called at the end. The call to current_msec() is always equivalent to current_time().
Returns
The current millisecond since the initialization of the library.

Example:

1 // This program illustrates the use of current_msec
2 #include <eyelink.h>
3 #include <stdio.h>
4 
5 eyemsg_printf("Delay test starts: %ld", current_msec());
6 msec_delay(100);
7 eyemsg_printf("Delay test ends: %ld", current_time());
    Output: 
1 MSG 4532575 Delay test starts: 5236
2 MSG 4532671 Delay test ends: 5336
    
See also
current_msec(), current_micro(), current_usec(), eyelink_tracker_time() and msec_delay()
UINT32 current_usec ( void  )

Returns the current microsecond since the initialization. Equivalent to current_micro() and current_double_usec().

Remarks
If the eyelink_exptkit library is not initialized, or initialized multiple times, the return value is invalid and unpredictable. The call to current_usec() is equivalent to current_micro(NULL). The function is very platform dependent. Platforms such as windows 95, 98, ME may not return usec properly. Ie. It may return current_time() * 1000.
Returns
The current microsecond since the initialization of the library, modulo 2^32.

Example:

1 // This program illustrates the use of current_micro and current_usec
2 
3 #include <eyelink.h>
4 #include <stdio.h>
5 
6 MICRO m1, m2; // Special high-resolution time structure
7 
8 // Get the current subject PC time in microseconds
9 current_micro(&m1);
10 eyemsg_printf("Delay test starts: %ld", current_usec());
11 
12 // Delay for 100 msec
13 msec_delay(100);
14 
15 // Get the current subject PC time again
16 current_micro(&m2);
17 eyemsg_printf("Delay test ends: %ld", current_usec());
18 
19 // Calculate the actual amount of delay
20 eyemsg_printf("Total Delay: %6.3f",
21  m2.msec + m2.usec/1000.0 - m1.msec + m1.usec/1000.0);

Output:

1 MSG 5441107 Delay test starts: 4610094
2 MSG 5441206 Delay test ends: 4710005
3 MSG 5441206 Total Delay: 100.003
See also
current_micro(), current_double_usec(), current_msec(), current_time() and msec_delay()
INT16 eyelink_reset_clock ( INT16  enable)

Initializes the high frequency clock.

With TSR interface under msdos, Start/stop timing resources.

Parameters
enableUsually <enable> is 1. However, in MS-DOS passing 0 will cleanup the timing resources. In other platforms passing 0 has no effect.
void msec_delay ( UINT32  n)

Does a unblocked delay using current_time().

Parameters
nn milliseconds to delay.

Example:

1 // This program illustrates the use of msec_delay
2 #include <eyelink.h>
3 #include <stdio.h>
4 
5 eyemsg_printf("Delay test starts: %ld", current_msec());
6 // delay for 100 msec
7 msec_delay(100);
8 eyemsg_printf("Delay test ends: %ld", current_time());

Output:

1 MSG 4346690 Delay test starts: 12768
2 MSG 4346791 Delay test ends: 12868
See also
current_msec() and pump_delay()

Copyright ©2002-2023, SR Research Ltd.