libkcal

icaltime.h

Go to the documentation of this file.
00001 /* -*- Mode: C -*- */
00002 /*======================================================================
00003  FILE: icaltime.h
00004  CREATOR: eric 02 June 2000
00005 
00006 
00007 
00008  (C) COPYRIGHT 2000, Eric Busboom <eric@softwarestudio.org>
00009      http://www.softwarestudio.org
00010 
00011  This program is free software; you can redistribute it and/or modify
00012  it under the terms of either: 
00013 
00014     The LGPL as published by the Free Software Foundation, version
00015     2.1, available at: http://www.fsf.org/copyleft/lesser.html
00016 
00017   Or:
00018 
00019     The Mozilla Public License Version 1.0. You may obtain a copy of
00020     the License at http://www.mozilla.org/MPL/
00021 
00022  The Original Code is eric. The Initial Developer of the Original
00023  Code is Eric Busboom
00024 
00025 
00026 ======================================================================*/
00027 
00092 #ifndef ICALTIME_H
00093 #define ICALTIME_H
00094 
00095 #include <time.h>
00096 /* An opaque struct representing a timezone. We declare this here to avoid
00097    a circular dependancy. */
00098 #ifndef ICALTIMEZONE_DEFINED
00099 #define ICALTIMEZONE_DEFINED
00100 typedef struct _icaltimezone        icaltimezone;
00101 #endif
00102 
00104 struct icaltime_span {
00105     time_t start;   
00106     time_t end;     
00107     int is_busy;    
00108 };
00109 
00110 typedef struct icaltime_span icaltime_span;
00111 
00112 /*
00113  *  FIXME
00114  *
00115  *  is_utc is redundant, and might be considered a minor optimization.
00116  *  It might be deprecated, so you should use icaltime_is_utc() instead.
00117  */
00118 struct icaltimetype
00119 {
00120     int year;   
00121     int month;  
00122     int day;
00123     int hour;
00124     int minute;
00125     int second;
00126 
00127     int is_utc;     
00129     int is_date;    
00131     int is_daylight; 
00133     icaltimezone *zone; 
00134 };  
00135 
00136 typedef struct icaltimetype icaltimetype;
00137 
00140 struct icaltimetype icaltime_null_time(void);
00141 
00143 struct icaltimetype icaltime_null_date(void);
00144 
00146 struct icaltimetype icaltime_current_time_with_zone(icaltimezone *zone);
00147 
00149 struct icaltimetype icaltime_today(void);
00150 
00152 struct icaltimetype icaltime_from_timet(const time_t v, const int is_date);
00153 
00155 struct icaltimetype icaltime_from_timet_with_zone(const time_t tm,
00156     const int is_date, icaltimezone *zone);
00157 
00159 struct icaltimetype icaltime_from_string(const char* str);
00160 
00162 struct icaltimetype icaltime_from_string_with_zone(const char* str,
00163     icaltimezone *zone);
00164 
00166 struct icaltimetype icaltime_from_day_of_year(const int doy,
00167     const int year);
00168 
00171 struct icaltimetype icaltime_from_week_number(const int week_number,
00172     const int year);
00173 
00175 time_t icaltime_as_timet(const struct icaltimetype);
00176 
00178 time_t icaltime_as_timet_with_zone(const struct icaltimetype tt,
00179     icaltimezone *zone);
00180 
00183 const char* icaltime_as_ical_string(const struct icaltimetype tt);
00184 
00186 icaltimezone *icaltime_get_timezone(const struct icaltimetype t);
00187 
00189 const char *icaltime_get_tzid(const struct icaltimetype t);
00190 
00192 struct icaltimetype icaltime_set_timezone(struct icaltimetype *t,
00193     icaltimezone *zone);
00194 
00196 int icaltime_day_of_year(const struct icaltimetype t);
00197 
00199 int icaltime_day_of_week(const struct icaltimetype t);
00200 
00203 int icaltime_start_doy_of_week(const struct icaltimetype t);
00204 
00206 int icaltime_week_number(const struct icaltimetype t);
00207 
00209 int icaltime_is_null_time(const struct icaltimetype t);
00210 
00214 int icaltime_is_valid_time(const struct icaltimetype t);
00215 
00217 int icaltime_is_date(const struct icaltimetype t);
00218 
00220 int icaltime_is_utc(const struct icaltimetype t);
00221 
00223 int icaltime_is_floating(const struct icaltimetype t);
00224 
00226 int icaltime_compare_with_zone(const struct icaltimetype a,
00227         const struct icaltimetype b);
00228 
00230 int icaltime_compare(const struct icaltimetype a,
00231     const struct icaltimetype b);
00232 
00234 int icaltime_compare_date_only(const struct icaltimetype a,
00235     const struct icaltimetype b);
00236 
00238 void  icaltime_adjust(struct icaltimetype *tt, const int days,
00239     const int hours, const int minutes, const int seconds);
00240 
00242 struct icaltimetype icaltime_normalize(const struct icaltimetype t);
00243 
00246 struct icaltimetype icaltime_convert_to_zone(const struct icaltimetype tt,
00247     icaltimezone *zone);
00248 
00250 int icaltime_days_in_month(const int month, const int year);
00251 
00252 
00254 struct icaltime_span icaltime_span_new(struct icaltimetype dtstart,
00255                        struct icaltimetype dtend,
00256                        int is_busy);
00257 
00259 int icaltime_span_overlaps(icaltime_span *s1, 
00260                icaltime_span *s2);
00261 
00265 int icaltime_span_contains(icaltime_span *s,
00266                icaltime_span *container);
00267 
00268 
00269 #endif /* !ICALTIME_H */
00270 
00271