aboutsummaryrefslogtreecommitdiffstats
path: root/libical/src
diff options
context:
space:
mode:
authorSeth Alves <alves@src.gnome.org>2000-04-25 04:07:19 +0800
committerSeth Alves <alves@src.gnome.org>2000-04-25 04:07:19 +0800
commitde46951fcff85cff53fec4bae4d04772f20ef854 (patch)
tree3702d6989a671793d342f51c24097c8d53538349 /libical/src
parent33f48d299ea754aa6679a092ad820e8c96a020f6 (diff)
downloadgsoc2013-evolution-de46951fcff85cff53fec4bae4d04772f20ef854.tar
gsoc2013-evolution-de46951fcff85cff53fec4bae4d04772f20ef854.tar.gz
gsoc2013-evolution-de46951fcff85cff53fec4bae4d04772f20ef854.tar.bz2
gsoc2013-evolution-de46951fcff85cff53fec4bae4d04772f20ef854.tar.lz
gsoc2013-evolution-de46951fcff85cff53fec4bae4d04772f20ef854.tar.xz
gsoc2013-evolution-de46951fcff85cff53fec4bae4d04772f20ef854.tar.zst
gsoc2013-evolution-de46951fcff85cff53fec4bae4d04772f20ef854.zip
convert from a time_t to an icaldurationtype.
* src/libical/icaltypes.c (icaldurationtype_from_timet): convert from a time_t to an icaldurationtype. svn path=/trunk/; revision=2589
Diffstat (limited to 'libical/src')
-rw-r--r--libical/src/libical/icaltypes.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libical/src/libical/icaltypes.c b/libical/src/libical/icaltypes.c
index 2800b4857f..25e0e12b48 100644
--- a/libical/src/libical/icaltypes.c
+++ b/libical/src/libical/icaltypes.c
@@ -193,6 +193,25 @@ time_t icaldurationtype_as_timet(struct icaldurationtype dur)
}
+struct icaldurationtype icaldurationtype_from_timet(time_t t)
+{
+ struct icaldurationtype dur;
+ time_t used = 0;
+
+ dur.weeks = (t - used) / (60 * 60 * 24 * 7);
+ used += dur.weeks * (60 * 60 * 24 * 7);
+ dur.days = (t - used) / (60 * 60 * 24);
+ used += dur.days * (60 * 60 * 24);
+ dur.hours = (t - used) / (60 * 60);
+ used += dur.hours * (60 * 60);
+ dur.minutes = (t - used) / (60);
+ used += dur.minutes * (60);
+ dur.seconds = (t - used);
+
+ return dur;
+}
+
+
void icalrecurrencetype_clear(struct icalrecurrencetype *recur)
{
memset(recur,ICAL_RECURRENCE_ARRAY_MAX_BYTE,