Back to index

lightning-sunbird  0.9+nobinonly
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  $Id: icaltime.h,v 1.25 2005/01/24 13:06:10 acampi Exp $
00008  $Locker:  $
00009 
00010  (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
00011 
00012  This program is free software; you can redistribute it and/or modify
00013  it under the terms of either: 
00014 
00015     The LGPL as published by the Free Software Foundation, version
00016     2.1, available at: http://www.fsf.org/copyleft/lesser.html
00017 
00018   Or:
00019 
00020     The Mozilla Public License Version 1.0. You may obtain a copy of
00021     the License at http://www.mozilla.org/MPL/
00022 
00023  The Original Code is eric. The Initial Developer of the Original
00024  Code is Eric Busboom
00025 
00026 
00027 ======================================================================*/
00028 
00093 #ifndef ICALTIME_H
00094 #define ICALTIME_H
00095 
00096 #include <time.h>
00097 
00098 /* An opaque struct representing a timezone. We declare this here to avoid
00099    a circular dependancy. */
00100 #ifndef ICALTIMEZONE_DEFINED
00101 #define ICALTIMEZONE_DEFINED
00102 typedef struct _icaltimezone              icaltimezone;
00103 #endif
00104 
00106 struct icaltime_span {
00107        time_t start;   
00108        time_t end;     
00109        int is_busy;    
00110 };
00111 
00112 typedef struct icaltime_span icaltime_span;
00113 
00114 /*
00115  *     FIXME
00116  *
00117  *     is_utc is redundant, and might be considered a minor optimization.
00118  *     It might be deprecated, so you should use icaltime_is_utc() instead.
00119  */
00120 struct icaltimetype
00121 {
00122        int year;     
00123        int month;    
00124        int day;
00125        int hour;
00126        int minute;
00127        int second;
00128 
00129        int is_utc;     
00131        int is_date;    
00133        int is_daylight; 
00135        const icaltimezone *zone;   
00136 };     
00137 
00138 typedef struct icaltimetype icaltimetype;
00139 
00142 struct icaltimetype icaltime_null_time(void);
00143 
00145 struct icaltimetype icaltime_null_date(void);
00146 
00148 struct icaltimetype icaltime_current_time_with_zone(const icaltimezone *zone);
00149 
00151 struct icaltimetype icaltime_today(void);
00152 
00154 struct icaltimetype icaltime_from_timet(const time_t v, const int is_date);
00155 
00157 struct icaltimetype icaltime_from_timet_with_zone(const time_t tm,
00158        const int is_date, const icaltimezone *zone);
00159 
00161 struct icaltimetype icaltime_from_string(const char* str);
00162 
00164 struct icaltimetype icaltime_from_string_with_zone(const char* str,
00165        const icaltimezone *zone);
00166 
00168 struct icaltimetype icaltime_from_day_of_year(const int doy,
00169        const int year);
00170 
00173 struct icaltimetype icaltime_from_week_number(const int week_number,
00174        const int year);
00175 
00177 time_t icaltime_as_timet(const struct icaltimetype);
00178 
00180 time_t icaltime_as_timet_with_zone(const struct icaltimetype tt,
00181        const icaltimezone *zone);
00182 
00185 const char* icaltime_as_ical_string(const struct icaltimetype tt);
00186 
00188 const icaltimezone *icaltime_get_timezone(const struct icaltimetype t);
00189 
00191 char *icaltime_get_tzid(const struct icaltimetype t);
00192 
00194 struct icaltimetype icaltime_set_timezone(struct icaltimetype *t,
00195        const icaltimezone *zone);
00196 
00198 int icaltime_day_of_year(const struct icaltimetype t);
00199 
00201 int icaltime_day_of_week(const struct icaltimetype t);
00202 
00205 int icaltime_start_doy_of_week(const struct icaltimetype t);
00206 
00209 int icaltime_start_doy_in_week(const struct icaltimetype t, int fdow);
00210 
00213 int icaltime_start_doy_week(const struct icaltimetype t, int fdow);
00214 
00216 int icaltime_week_number(const struct icaltimetype t);
00217 
00219 int icaltime_is_null_time(const struct icaltimetype t);
00220 
00224 int icaltime_is_valid_time(const struct icaltimetype t);
00225 
00227 int icaltime_is_date(const struct icaltimetype t);
00228 
00230 int icaltime_is_utc(const struct icaltimetype t);
00231 
00233 int icaltime_is_floating(const struct icaltimetype t);
00234 
00236 int icaltime_compare_with_zone(const struct icaltimetype a,
00237         const struct icaltimetype b);
00238 
00240 int icaltime_compare(const struct icaltimetype a,
00241        const struct icaltimetype b);
00242 
00244 int icaltime_compare_date_only(const struct icaltimetype a,
00245        const struct icaltimetype b, icaltimezone *tz);
00246 
00248 void  icaltime_adjust(struct icaltimetype *tt, const int days,
00249        const int hours, const int minutes, const int seconds);
00250 
00252 struct icaltimetype icaltime_normalize(const struct icaltimetype t);
00253 
00256 struct icaltimetype icaltime_convert_to_zone(const struct icaltimetype tt,
00257        icaltimezone *zone);
00258 
00260 int icaltime_days_in_month(const int month, const int year);
00261 
00262 
00264 struct icaltime_span icaltime_span_new(struct icaltimetype dtstart,
00265                                    struct icaltimetype dtend,
00266                                    int is_busy);
00267 
00269 int icaltime_span_overlaps(icaltime_span *s1, 
00270                         icaltime_span *s2);
00271 
00275 int icaltime_span_contains(icaltime_span *s,
00276                         icaltime_span *container);
00277 
00278 
00279 #endif /* !ICALTIME_H */
00280 
00281