---
name: "dtk_gettime"
section: "3"
platform: "linux"
package: "libdrawtk-dev"
version: "2.0-2.1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/dtk_gettime"
---

# dtk\_gettime(3)

high resolution timestamp

## NAME

dtk\_gettime - high resolution timestamp

## SYNOPSIS

**#include \<dtk\_time.h\>**

**void dtk\_gettime(struct dtk\_timespec\*** *ts***);**\

## DESCRIPTION

The function **dtk\_gettime**() retrieves the time of a high precision clock. The time is returned in the *ts* argument which is a pointer to a dtk\_timespec structure defined as:

```
struct dtk_timespec {
    long sec;    /* seconds */
    long nsec;   /* nanoseconds */
};
```

The time represents seconds and nanoseconds since the Epoch, 1970-01-01 00:00:00 +0000  (UTC).

## RETURN VALUE

None

## NOTE

This function is wrapper to [**clock\_gettime**(2)](/clock_gettime/2.md) if it is provided by the system. Otherwise, it implements the function by using the timer with the highest precision available on the system.

## SEE ALSO

[**dtk\_nanosleep**(3)](/dtk_nanosleep/3.md), [**clock\_gettime**(2)](/clock_gettime/2.md)
