src/timestamp.h
author Volker Birk <vb@pep-project.org>
Wed, 29 Apr 2015 14:51:33 +0200
changeset 229 313d152239bf
parent 124 e2930c783d3c
child 1513 e7f7e42385b5
permissions -rw-r--r--
fixing preprocessor
vb@124
     1
#pragma once
vb@124
     2
vb@124
     3
#include <time.h>
vb@124
     4
#include "dynamic_api.h"
vb@124
     5
vb@124
     6
#ifdef __cplusplus
vb@124
     7
extern "C" {
vb@124
     8
#endif
vb@124
     9
vb@124
    10
vb@124
    11
// for time values all functions are using POSIX struct tm
vb@124
    12
vb@124
    13
typedef struct tm timestamp;
vb@124
    14
vb@124
    15
vb@124
    16
// new_timestamp() - allocate a new timestamp
vb@124
    17
//
vb@124
    18
//  parameters:
vb@124
    19
//      clock (in)      initial value or 0 if not available
vb@124
    20
//
vb@124
    21
//  return value:
vb@124
    22
//      pointer to timestamp object or NULL if out of memory
vb@124
    23
vb@124
    24
DYNAMIC_API timestamp * new_timestamp(time_t clock);
vb@124
    25
vb@124
    26
vb@124
    27
// free_timestamp() - free memory occupied by timestamp
vb@124
    28
//
vb@124
    29
//  parameters:
vb@124
    30
//      ts (in)         pointer to timestamp to free
vb@124
    31
vb@124
    32
DYNAMIC_API void free_timestamp(timestamp *ts);
vb@124
    33
vb@124
    34
vb@124
    35
// timestamp_dup() - duplicate a timestamp
vb@124
    36
//
vb@124
    37
//  parameters:
vb@124
    38
//      src (in)        pointer to timestamp to duplicate
vb@124
    39
//
vb@124
    40
//  return value:
vb@124
    41
//      pointer to copy or NULL if out of memory
vb@124
    42
vb@124
    43
DYNAMIC_API timestamp * timestamp_dup(const timestamp *src);
vb@124
    44
vb@124
    45
vb@124
    46
#ifdef __cplusplus
vb@124
    47
}
vb@124
    48
#endif
vb@124
    49