src/timestamp.h
author Dirk Zimmermann <dz@pep.security>
Thu, 11 Apr 2019 10:46:46 +0200
branchIOS-1482
changeset 3505 3fe4b41696d3
parent 1513 e7f7e42385b5
permissions -rw-r--r--
IOS-1482 close branch
vb@1513
     1
// This file is under GNU General Public License 3.0
vb@1513
     2
// see LICENSE.txt
vb@1513
     3
vb@124
     4
#pragma once
vb@124
     5
vb@124
     6
#include <time.h>
vb@124
     7
#include "dynamic_api.h"
vb@124
     8
vb@124
     9
#ifdef __cplusplus
vb@124
    10
extern "C" {
vb@124
    11
#endif
vb@124
    12
vb@124
    13
vb@124
    14
// for time values all functions are using POSIX struct tm
vb@124
    15
vb@124
    16
typedef struct tm timestamp;
vb@124
    17
vb@124
    18
vb@124
    19
// new_timestamp() - allocate a new timestamp
vb@124
    20
//
vb@124
    21
//  parameters:
vb@124
    22
//      clock (in)      initial value or 0 if not available
vb@124
    23
//
vb@124
    24
//  return value:
vb@124
    25
//      pointer to timestamp object or NULL if out of memory
vb@124
    26
vb@124
    27
DYNAMIC_API timestamp * new_timestamp(time_t clock);
vb@124
    28
vb@124
    29
vb@124
    30
// free_timestamp() - free memory occupied by timestamp
vb@124
    31
//
vb@124
    32
//  parameters:
vb@124
    33
//      ts (in)         pointer to timestamp to free
vb@124
    34
vb@124
    35
DYNAMIC_API void free_timestamp(timestamp *ts);
vb@124
    36
vb@124
    37
vb@124
    38
// timestamp_dup() - duplicate a timestamp
vb@124
    39
//
vb@124
    40
//  parameters:
vb@124
    41
//      src (in)        pointer to timestamp to duplicate
vb@124
    42
//
vb@124
    43
//  return value:
vb@124
    44
//      pointer to copy or NULL if out of memory
vb@124
    45
vb@124
    46
DYNAMIC_API timestamp * timestamp_dup(const timestamp *src);
vb@124
    47
vb@124
    48
vb@124
    49
#ifdef __cplusplus
vb@124
    50
}
vb@124
    51
#endif
vb@124
    52