1 /*
2 * Copyright (C) 2015 Andrew Beekhof <andrew@beekhof.net>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 #ifndef CRM_COMMON_ISO8601_INTERNAL
20 # define CRM_COMMON_ISO8601_INTERNAL
21 #include <time.h>
22 #include <sys/time.h>
23 #include <ctype.h>
24 #include <crm/common/iso8601.h>
25
26 typedef struct crm_time_us crm_time_hr_t;
27 crm_time_hr_t *crm_time_hr_convert(crm_time_hr_t *target, crm_time_t *dt);
28 void crm_time_set_hr_dt(crm_time_t *target, crm_time_hr_t *hr_dt);
29 crm_time_hr_t *crm_time_timeval_hr_convert(crm_time_hr_t *target,
30 struct timeval *tv);
31 crm_time_hr_t *crm_time_hr_new(const char *date_time);
32 void crm_time_hr_free(crm_time_hr_t * hr_dt);
33 char *crm_time_format_hr(const char *format, crm_time_hr_t * hr_dt);
34
35 crm_time_t *parse_date(const char *date_str); /* in iso8601.c global but
36 not in header */
37
38 struct crm_time_us {
39 int years;
40 int months; /* Only for durations */
41 int days;
42 int seconds;
43 int offset; /* Seconds */
44 bool duration;
45 int useconds;
46 };
47 #endif