Libical API Documentation  3.0
icalduration.h
Go to the documentation of this file.
1 /*======================================================================
2  FILE: icalduration.h
3  CREATOR: eric 26 Jan 2001
4 
5  (C) COPYRIGHT 2000, Eric Busboom <eric@civicknowledge.com>
6 
7  This library is free software; you can redistribute it and/or modify
8  it under the terms of either:
9 
10  The LGPL as published by the Free Software Foundation, version
11  2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
12 
13  Or:
14 
15  The Mozilla Public License Version 2.0. You may obtain a copy of
16  the License at https://www.mozilla.org/MPL/
17 
18  The Original Code is eric. The Initial Developer of the Original
19  Code is Eric Busboom
20 ======================================================================*/
21 
22 #ifndef ICALDURATION_H
23 #define ICALDURATION_H
24 
30 #include "libical_ical_export.h"
31 #include "icaltime.h"
32 
37 {
38  int is_neg;
39  unsigned int days;
40  unsigned int weeks;
41  unsigned int hours;
42  unsigned int minutes;
43  unsigned int seconds;
44 };
45 
46 #define ICALDURATIONTYPE_INITIALIZER { 0, 0, 0, 0, 0, 0 }
47 
63 LIBICAL_ICAL_EXPORT struct icaldurationtype icaldurationtype_from_int(int t);
64 
84 LIBICAL_ICAL_EXPORT struct icaldurationtype icaldurationtype_from_string(const char *dur);
85 
101 LIBICAL_ICAL_EXPORT int icaldurationtype_as_int(struct icaldurationtype duration);
102 
127 LIBICAL_ICAL_EXPORT char *icaldurationtype_as_ical_string(struct icaldurationtype d);
128 
149 LIBICAL_ICAL_EXPORT char *icaldurationtype_as_ical_string_r(struct icaldurationtype d);
150 
172 LIBICAL_ICAL_EXPORT struct icaldurationtype icaldurationtype_null_duration(void);
173 
189 LIBICAL_ICAL_EXPORT struct icaldurationtype icaldurationtype_bad_duration(void);
190 
207 LIBICAL_ICAL_EXPORT int icaldurationtype_is_null_duration(struct icaldurationtype d);
208 
225 LIBICAL_ICAL_EXPORT int icaldurationtype_is_bad_duration(struct icaldurationtype d);
226 
246 LIBICAL_ICAL_EXPORT struct icaltimetype icaltime_add(struct icaltimetype t,
247  struct icaldurationtype d);
248 
266 LIBICAL_ICAL_EXPORT struct icaldurationtype icaltime_subtract(struct icaltimetype t1,
267  struct icaltimetype t2);
268 
269 #endif /* !ICALDURATION_H */
struct icaldurationtype icaltime_subtract(struct icaltimetype t1, struct icaltimetype t2)
Returns the difference between two icaltimetype as a duration.
Definition: icalduration.c:339
int icaldurationtype_as_int(struct icaldurationtype duration)
Converts an icaldurationtype into the duration in seconds as int.
Definition: icalduration.c:270
struct icaldurationtype icaldurationtype_from_int(int t)
Creates a new icaldurationtype from a duration in seconds.
Definition: icalduration.c:32
struct icaldurationtype icaldurationtype_from_string(const char *dur)
Creates a new icaldurationtype from a duration given as a string.
Definition: icalduration.c:62
struct icaltimetype is a pseudo-object that abstracts time handling.
struct icaltimetype icaltime_add(struct icaltimetype t, struct icaldurationtype d)
Adds a duration to an icaltime object and returns the result.
Definition: icalduration.c:318
int icaldurationtype_is_bad_duration(struct icaldurationtype d)
Checks if a duration is a bad duration.
Definition: icalduration.c:313
A struct representing a duration.
Definition: icalduration.h:36
struct icaldurationtype icaldurationtype_null_duration(void)
Creates a duration with zero length.
Definition: icalduration.c:279
char * icaldurationtype_as_ical_string_r(struct icaldurationtype d)
Definition: icalduration.c:220
Definition: icaltime.h:104
char * icaldurationtype_as_ical_string(struct icaldurationtype d)
Definition: icalduration.c:211
int icaldurationtype_is_null_duration(struct icaldurationtype d)
Checks if a duration is a null duration.
Definition: icalduration.c:288
struct icaldurationtype icaldurationtype_bad_duration(void)
Creates a bad duration (used to indicate error).
Definition: icalduration.c:304