timestamp.h File Reference

Portable routines for high resolution timing. More...

`#include "int_sizes.h"`
`#include <time.h>`

Go to the source code of this file.

## Typedefs

typedef UINT64_T | timestamp_t
| A type to hold the current time, in microseconds since January 1st, 1970.

## Functions

timestamp_t | timestamp_get (void)
| Get the current time.
int | timestamp_fmt (char *buf, size_t size, const char *fmt, timestamp_t ts)
| Formats timestamp_t ts according to the format specification fmt and stores the result as a string in array buf.
void | timestamp_sleep (timestamp_t interval)
| Sleep for a specified time.
time_t | timestamp_file (const char *file)
| Get the last modified time of a file.

## Detailed Description

Portable routines for high resolution timing.

## Typedef Documentation

## timestamp_t

typedef UINT64_T timestamp_t

A type to hold the current time, in microseconds since January 1st, 1970.

## Function Documentation

## timestamp_get()

timestamp_t timestamp_get | ( | void |  | ) |

Get the current time.

Returns
  The current time, in microseconds since January 1st, 1970.

## timestamp_fmt()

int timestamp_fmt | ( | char * | buf,
|  | size_t | size,
|  | const char * | fmt,
|  | timestamp_t | ts )

Formats timestamp_t ts according to the format specification fmt and stores the result as a string in array buf.

Parameters

  buf | The array that holds the formatted string.
  size | The size of array buf.
  fmt | The specification of the desired format.
  ts | The time value to format.

Returns
  The number of characters placed in the array buf.

## timestamp_sleep()

void timestamp_sleep | ( | timestamp_t | interval | ) |

Sleep for a specified time.

Parameters

  interval | The number of microseconds to sleep for.

## timestamp_file()

time_t timestamp_file | ( | const char * | file | ) |

Get the last modified time of a file.

Parameters

  file | The path of the file to examine.

Returns
  The modification time, in seconds since January 1st, 1970.