src/timestamp.h
changeset 124 e2930c783d3c
child 1513 e7f7e42385b5
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/timestamp.h	Wed Mar 25 12:55:15 2015 +0100
     1.3 @@ -0,0 +1,49 @@
     1.4 +#pragma once
     1.5 +
     1.6 +#include <time.h>
     1.7 +#include "dynamic_api.h"
     1.8 +
     1.9 +#ifdef __cplusplus
    1.10 +extern "C" {
    1.11 +#endif
    1.12 +
    1.13 +
    1.14 +// for time values all functions are using POSIX struct tm
    1.15 +
    1.16 +typedef struct tm timestamp;
    1.17 +
    1.18 +
    1.19 +// new_timestamp() - allocate a new timestamp
    1.20 +//
    1.21 +//  parameters:
    1.22 +//      clock (in)      initial value or 0 if not available
    1.23 +//
    1.24 +//  return value:
    1.25 +//      pointer to timestamp object or NULL if out of memory
    1.26 +
    1.27 +DYNAMIC_API timestamp * new_timestamp(time_t clock);
    1.28 +
    1.29 +
    1.30 +// free_timestamp() - free memory occupied by timestamp
    1.31 +//
    1.32 +//  parameters:
    1.33 +//      ts (in)         pointer to timestamp to free
    1.34 +
    1.35 +DYNAMIC_API void free_timestamp(timestamp *ts);
    1.36 +
    1.37 +
    1.38 +// timestamp_dup() - duplicate a timestamp
    1.39 +//
    1.40 +//  parameters:
    1.41 +//      src (in)        pointer to timestamp to duplicate
    1.42 +//
    1.43 +//  return value:
    1.44 +//      pointer to copy or NULL if out of memory
    1.45 +
    1.46 +DYNAMIC_API timestamp * timestamp_dup(const timestamp *src);
    1.47 +
    1.48 +
    1.49 +#ifdef __cplusplus
    1.50 +}
    1.51 +#endif
    1.52 +