« Close

Datasheets and User Guides

Software & Driver


2.7.1 - GetHostTick

Queries the host system's steady (monotonic) clock, preferentially with high precision.




The current clock tick in microseconds, as a 64-bit integer. Resolution may vary.

On Windows, sleep states (such as standby, hibernate, or connected standby) do not affect LJM_GetHostTick. Other platforms should be manually tested.


Some development environments can not handle the 64-bit return value.  In such cases use LJM_GetHostTick32Bit which uses 2 32-bit parameters to return the clock tick.


[C/C++] Measure how long an operation takes.

double value;
long long time0 = LJM_GetHostTick();
err = LJM_eReadName(handle, "SERIAL_NUMBER", &value);
long long time1 = LJM_GetHostTick();
ErrorCheck(err, "LJM_eReadName");
printf("LJM_eReadName took %lld microseconds.\n", time1 - time0);

Device I/O times can vary greatly, but this prints something like:

LJM_eReadName took 338 microseconds.