author | Volker Birk <vb@pep.foundation> |
Thu, 01 Sep 2016 17:55:03 +0200 | |
branch | keysync |
changeset 1111 | 3c46dc58096d |
parent 125 | 5119178815d8 |
child 1513 | e7f7e42385b5 |
permissions | -rw-r--r-- |
1 #include "pEp_internal.h"
3 #include "timestamp.h"
5 #include <stdlib.h>
6 #include <string.h>
7 #include <assert.h>
9 DYNAMIC_API timestamp * new_timestamp(time_t clock)
10 {
11 timestamp *ts = calloc(1, sizeof(timestamp));
12 assert(ts);
13 if (ts == NULL)
14 return NULL;
16 if (clock)
17 gmtime_r(&clock, ts);
19 return ts;
20 }
23 DYNAMIC_API void free_timestamp(timestamp *ts)
24 {
25 free(ts);
26 }
28 DYNAMIC_API timestamp * timestamp_dup(const timestamp *src)
29 {
30 timestamp *dst = malloc(sizeof(timestamp));
31 assert(dst);
32 if (dst == NULL)
33 return NULL;
35 memcpy(dst, src, sizeof(timestamp));
36 return dst;
37 }