libkcal

icaltime.h File Reference

struct icaltimetype is a pseudo-object that abstracts time handling. More...

#include <time.h>

Include dependency graph for icaltime.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


Classes

struct  icaltime_span
 icaltime_span is returned by icalcomponent_get_span() More...
struct  icaltimetype

Typedefs

typedef struct icaltime_span icaltime_span
typedef struct icaltimetype icaltimetype
typedef struct _icaltimezone icaltimezone

Functions

void icaltime_adjust (struct icaltimetype *tt, const int days, const int hours, const int minutes, const int seconds)
const char * icaltime_as_ical_string (const struct icaltimetype tt)
time_t icaltime_as_timet (const struct icaltimetype)
time_t icaltime_as_timet_with_zone (const struct icaltimetype tt, icaltimezone *zone)
int icaltime_compare (const struct icaltimetype a, const struct icaltimetype b)
int icaltime_compare_date_only (const struct icaltimetype a, const struct icaltimetype b)
int icaltime_compare_with_zone (const struct icaltimetype a, const struct icaltimetype b)
struct icaltimetype icaltime_convert_to_zone (const struct icaltimetype tt, icaltimezone *zone)
struct icaltimetype icaltime_current_time_with_zone (icaltimezone *zone)
int icaltime_day_of_week (const struct icaltimetype t)
int icaltime_day_of_year (const struct icaltimetype t)
int icaltime_days_in_month (const int month, const int year)
struct icaltimetype icaltime_from_day_of_year (const int doy, const int year)
struct icaltimetype icaltime_from_string (const char *str)
struct icaltimetype icaltime_from_string_with_zone (const char *str, icaltimezone *zone)
struct icaltimetype icaltime_from_timet (const time_t v, const int is_date)
struct icaltimetype icaltime_from_timet_with_zone (const time_t tm, const int is_date, icaltimezone *zone)
struct icaltimetype icaltime_from_week_number (const int week_number, const int year)
icaltimezoneicaltime_get_timezone (const struct icaltimetype t)
const char * icaltime_get_tzid (const struct icaltimetype t)
int icaltime_is_date (const struct icaltimetype t)
int icaltime_is_floating (const struct icaltimetype t)
int icaltime_is_null_time (const struct icaltimetype t)
int icaltime_is_utc (const struct icaltimetype t)
int icaltime_is_valid_time (const struct icaltimetype t)
struct icaltimetype icaltime_normalize (const struct icaltimetype t)
struct icaltimetype icaltime_null_date (void)
struct icaltimetype icaltime_null_time (void)
struct icaltimetype icaltime_set_timezone (struct icaltimetype *t, icaltimezone *zone)
int icaltime_span_contains (icaltime_span *s, icaltime_span *container)
struct icaltime_span icaltime_span_new (struct icaltimetype dtstart, struct icaltimetype dtend, int is_busy)
int icaltime_span_overlaps (icaltime_span *s1, icaltime_span *s2)
int icaltime_start_doy_of_week (const struct icaltimetype t)
struct icaltimetype icaltime_today (void)
int icaltime_week_number (const struct icaltimetype t)

Detailed Description

struct icaltimetype is a pseudo-object that abstracts time handling.

It can represent either a DATE or a DATE-TIME (floating, UTC or in a given timezone), and it keeps track internally of its native timezone.

The typical usage is to call the correct constructor specifying the desired timezone. If this is not known until a later time, the correct behavior is to specify a NULL timezone and call icaltime_convert_to_zone() at a later time.

There are several ways to create a new icaltimetype:

italtimetype objects can be converted to different formats:

Accessor methods include:

Query methods include:

Modify, compare and utility methods include:

Definition in file icaltime.h.


Typedef Documentation

typedef struct icaltime_span icaltime_span

Definition at line 110 of file icaltime.h.

typedef struct icaltimetype icaltimetype

Definition at line 136 of file icaltime.h.

typedef struct _icaltimezone icaltimezone

Definition at line 100 of file icaltime.h.


Function Documentation

void icaltime_adjust ( struct icaltimetype tt,
const int  days,
const int  hours,
const int  minutes,
const int  seconds 
)

Adds or subtracts a number of days, hours, minutes and seconds.

const char* icaltime_as_ical_string ( const struct icaltimetype  tt  ) 

Return a string represention of the time, in RFC2445 format.

The string is owned by libical

time_t icaltime_as_timet ( const struct icaltimetype   ) 

Return the time as seconds past the UNIX epoch.

time_t icaltime_as_timet_with_zone ( const struct icaltimetype  tt,
icaltimezone zone 
)

Return the time as seconds past the UNIX epoch, using timezones.

int icaltime_compare ( const struct icaltimetype  a,
const struct icaltimetype  b 
)

Return -1, 0, or 1 to indicate that a<b, a==b or a>b.

int icaltime_compare_date_only ( const struct icaltimetype  a,
const struct icaltimetype  b 
)

like icaltime_compare, but only use the date parts.

int icaltime_compare_with_zone ( const struct icaltimetype  a,
const struct icaltimetype  b 
)

Return -1, 0, or 1 to indicate that a<b, a==b or a>b.

struct icaltimetype icaltime_convert_to_zone ( const struct icaltimetype  tt,
icaltimezone zone 
) [read]

convert tt, of timezone tzid, into a utc time.

Does nothing if the time is already UTC.

struct icaltimetype icaltime_current_time_with_zone ( icaltimezone zone  )  [read]

Returns the current time in the given timezone, as an icaltimetype.

int icaltime_day_of_week ( const struct icaltimetype  t  ) 

Return the day of the week of the given time.

Sunday is 1

int icaltime_day_of_year ( const struct icaltimetype  t  ) 

Return the day of the year of the given time.

int icaltime_days_in_month ( const int  month,
const int  year 
)

Return the number of days in the given month.

struct icaltimetype icaltime_from_day_of_year ( const int  doy,
const int  year 
) [read]

Create a new time, given a day of year and a year.

struct icaltimetype icaltime_from_string ( const char *  str  )  [read]

create a time from an ISO format string

struct icaltimetype icaltime_from_string_with_zone ( const char *  str,
icaltimezone zone 
) [read]

create a time from an ISO format string

struct icaltimetype icaltime_from_timet ( const time_t  v,
const int  is_date 
) [read]

Convert seconds past UNIX epoch to a timetype.

struct icaltimetype icaltime_from_timet_with_zone ( const time_t  tm,
const int  is_date,
icaltimezone zone 
) [read]

Convert seconds past UNIX epoch to a timetype, using timezones.

struct icaltimetype icaltime_from_week_number ( const int  week_number,
const int  year 
) [read]

Contructor (TODO).

Create a new time from a weeknumber and a year.

icaltimezone* icaltime_get_timezone ( const struct icaltimetype  t  ) 

Return the timezone.

const char* icaltime_get_tzid ( const struct icaltimetype  t  ) 

Return the tzid, or NULL for a floating time.

int icaltime_is_date ( const struct icaltimetype  t  ) 

Returns true if time is of DATE type, false if DATE-TIME.

int icaltime_is_floating ( const struct icaltimetype  t  ) 

Returns true if time is a floating time.

int icaltime_is_null_time ( const struct icaltimetype  t  ) 

Return true of the time is null.

int icaltime_is_utc ( const struct icaltimetype  t  ) 

Returns true if time is relative to UTC zone.

int icaltime_is_valid_time ( const struct icaltimetype  t  ) 

Returns false if the time is clearly invalid, but is not null.

This is usually the result of creating a new time type buy not clearing it, or setting one of the flags to an illegal value.

struct icaltimetype icaltime_normalize ( const struct icaltimetype  t  )  [read]

Normalize the icaltime, so that all fields are within the normal range.

struct icaltimetype icaltime_null_date ( void   )  [read]

Return a null date.

struct icaltimetype icaltime_null_time ( void   )  [read]

Return a null time, which indicates no time has been set.

This time represent the beginning of the epoch

struct icaltimetype icaltime_set_timezone ( struct icaltimetype t,
icaltimezone zone 
) [read]

Set the timezone.

int icaltime_span_contains ( icaltime_span s,
icaltime_span container 
)

Returns true if the span is totally within the containing span.

struct icaltime_span icaltime_span_new ( struct icaltimetype  dtstart,
struct icaltimetype  dtend,
int  is_busy 
) [read]

calculate an icaltimespan given a start and end time.

int icaltime_span_overlaps ( icaltime_span s1,
icaltime_span s2 
)

Returns true if the two spans overlap.

int icaltime_start_doy_of_week ( const struct icaltimetype  t  ) 

Return the day of the year for the Sunday of the week that the given time is within.

struct icaltimetype icaltime_today ( void   )  [read]

Returns the current day as an icaltimetype, with is_date set.

int icaltime_week_number ( const struct icaltimetype  t  ) 

Return the week number for the week the given time is within.