<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 
               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="libecal-e-cal-time-util">
<refmeta>
<refentrytitle role="top_of_page" id="libecal-e-cal-time-util.top_of_page">e-cal-time-util</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>LIBECAL Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>e-cal-time-util</refname>
<refpurpose>Time management utility functions.</refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>

<refsynopsisdiv id="libecal-e-cal-time-util.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>
<link linkend="int">int</link>                 <link linkend="time-days-in-month">time_days_in_month</link>                  (<link linkend="int">int</link> year,
                                                         <link linkend="int">int</link> month);
<link linkend="int">int</link>                 <link linkend="time-day-of-year">time_day_of_year</link>                    (<link linkend="int">int</link> day,
                                                         <link linkend="int">int</link> month,
                                                         <link linkend="int">int</link> year);
<link linkend="int">int</link>                 <link linkend="time-day-of-week">time_day_of_week</link>                    (<link linkend="int">int</link> day,
                                                         <link linkend="int">int</link> month,
                                                         <link linkend="int">int</link> year);
<link linkend="gboolean">gboolean</link>            <link linkend="time-is-leap-year">time_is_leap_year</link>                   (<link linkend="int">int</link> year);
<link linkend="int">int</link>                 <link linkend="time-leap-years-up-to">time_leap_years_up_to</link>               (<link linkend="int">int</link> year);
<link linkend="char">char</link>*               <link linkend="isodate-from-time-t">isodate_from_time_t</link>                 (<link linkend="time-t">time_t</link> t);
<link linkend="time-t">time_t</link>              <link linkend="time-from-isodate">time_from_isodate</link>                   (const <link linkend="char">char</link> *str);
<link linkend="time-t">time_t</link>              <link linkend="time-add-day">time_add_day</link>                        (<link linkend="time-t">time_t</link> time,
                                                         <link linkend="int">int</link> days);
<link linkend="time-t">time_t</link>              <link linkend="time-add-week">time_add_week</link>                       (<link linkend="time-t">time_t</link> time,
                                                         <link linkend="int">int</link> weeks);
<link linkend="time-t">time_t</link>              <link linkend="time-day-begin">time_day_begin</link>                      (<link linkend="time-t">time_t</link> t);
<link linkend="time-t">time_t</link>              <link linkend="time-day-end">time_day_end</link>                        (<link linkend="time-t">time_t</link> t);
<link linkend="time-t">time_t</link>              <link linkend="time-add-day-with-zone">time_add_day_with_zone</link>              (<link linkend="time-t">time_t</link> time,
                                                         <link linkend="int">int</link> days,
                                                         <link linkend="icaltimezone">icaltimezone</link> *zone);
<link linkend="time-t">time_t</link>              <link linkend="time-add-week-with-zone">time_add_week_with_zone</link>             (<link linkend="time-t">time_t</link> time,
                                                         <link linkend="int">int</link> weeks,
                                                         <link linkend="icaltimezone">icaltimezone</link> *zone);
<link linkend="time-t">time_t</link>              <link linkend="time-add-month-with-zone">time_add_month_with_zone</link>            (<link linkend="time-t">time_t</link> time,
                                                         <link linkend="int">int</link> months,
                                                         <link linkend="icaltimezone">icaltimezone</link> *zone);
<link linkend="time-t">time_t</link>              <link linkend="time-year-begin-with-zone">time_year_begin_with_zone</link>           (<link linkend="time-t">time_t</link> time,
                                                         <link linkend="icaltimezone">icaltimezone</link> *zone);
<link linkend="time-t">time_t</link>              <link linkend="time-month-begin-with-zone">time_month_begin_with_zone</link>          (<link linkend="time-t">time_t</link> time,
                                                         <link linkend="icaltimezone">icaltimezone</link> *zone);
<link linkend="time-t">time_t</link>              <link linkend="time-week-begin-with-zone">time_week_begin_with_zone</link>           (<link linkend="time-t">time_t</link> time,
                                                         <link linkend="int">int</link> week_start_day,
                                                         <link linkend="icaltimezone">icaltimezone</link> *zone);
<link linkend="time-t">time_t</link>              <link linkend="time-day-begin-with-zone">time_day_begin_with_zone</link>            (<link linkend="time-t">time_t</link> time,
                                                         <link linkend="icaltimezone">icaltimezone</link> *zone);
<link linkend="time-t">time_t</link>              <link linkend="time-day-end-with-zone">time_day_end_with_zone</link>              (<link linkend="time-t">time_t</link> time,
                                                         <link linkend="icaltimezone">icaltimezone</link> *zone);
<link linkend="void">void</link>                <link linkend="time-to-gdate-with-zone">time_to_gdate_with_zone</link>             (<link linkend="GDate">GDate</link> *date,
                                                         <link linkend="time-t">time_t</link> time,
                                                         <link linkend="icaltimezone">icaltimezone</link> *zone);
struct <link linkend="tm">tm</link>           <link linkend="icaltimetype-to-tm">icaltimetype_to_tm</link>                  (<link linkend="struct-icaltimetype">struct icaltimetype</link> *itt);
struct <link linkend="tm">tm</link>           <link linkend="icaltimetype-to-tm-with-zone">icaltimetype_to_tm_with_zone</link>        (<link linkend="struct-icaltimetype">struct icaltimetype</link> *itt,
                                                         <link linkend="icaltimezone">icaltimezone</link> *from_zone,
                                                         <link linkend="icaltimezone">icaltimezone</link> *to_zone);
struct <link linkend="icaltimetype">icaltimetype</link> <link linkend="tm-to-icaltimetype">tm_to_icaltimetype</link>                  (<link linkend="struct-tm">struct tm</link> *tm,
                                                         <link linkend="gboolean">gboolean</link> is_date);
</synopsis>
</refsynopsisdiv>









<refsect1 id="libecal-e-cal-time-util.description" role="desc">
<title role="desc.title">Description</title>
<para>

</para>
</refsect1>

<refsect1 id="libecal-e-cal-time-util.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="time-days-in-month" role="function">
<title>time_days_in_month ()</title>
<indexterm zone="time-days-in-month"><primary>time_days_in_month</primary></indexterm><programlisting><link linkend="int">int</link>                 time_days_in_month                  (<link linkend="int">int</link> year,
                                                         <link linkend="int">int</link> month);</programlisting>
<para>
Returns the number of days in the month. Year is the normal year, e.g. 2001.
Month is 0 (Jan) to 11 (Dec).</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>year</parameter>&nbsp;:</term>
<listitem><simpara> The year.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>month</parameter>&nbsp;:</term>
<listitem><simpara> The month.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> number of days in the given month/year.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="time-day-of-year" role="function">
<title>time_day_of_year ()</title>
<indexterm zone="time-day-of-year"><primary>time_day_of_year</primary></indexterm><programlisting><link linkend="int">int</link>                 time_day_of_year                    (<link linkend="int">int</link> day,
                                                         <link linkend="int">int</link> month,
                                                         <link linkend="int">int</link> year);</programlisting>
<para>
Returns the 1-based day number within the year of the specified date.
Year is the normal year, e.g. 2001. Month is 0 to 11.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>day</parameter>&nbsp;:</term>
<listitem><simpara> The day.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>month</parameter>&nbsp;:</term>
<listitem><simpara> The month.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>year</parameter>&nbsp;:</term>
<listitem><simpara> The year.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the day of the year.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="time-day-of-week" role="function">
<title>time_day_of_week ()</title>
<indexterm zone="time-day-of-week"><primary>time_day_of_week</primary></indexterm><programlisting><link linkend="int">int</link>                 time_day_of_week                    (<link linkend="int">int</link> day,
                                                         <link linkend="int">int</link> month,
                                                         <link linkend="int">int</link> year);</programlisting>
<para>
Returns the day of the week for the specified date, 0 (Sun) to 6 (Sat).
For the days that were removed on the Gregorian reformation, it returns
Thursday. Year is the normal year, e.g. 2001. Month is 0 to 11.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>day</parameter>&nbsp;:</term>
<listitem><simpara> The day.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>month</parameter>&nbsp;:</term>
<listitem><simpara> The month.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>year</parameter>&nbsp;:</term>
<listitem><simpara> The year.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the day of the week for the given date.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="time-is-leap-year" role="function">
<title>time_is_leap_year ()</title>
<indexterm zone="time-is-leap-year"><primary>time_is_leap_year</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            time_is_leap_year                   (<link linkend="int">int</link> year);</programlisting>
<para>
Returns whether the specified year is a leap year. Year is the normal year,
e.g. 2001.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>year</parameter>&nbsp;:</term>
<listitem><simpara> The year.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> TRUE if the year is leap, FALSE if not.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="time-leap-years-up-to" role="function">
<title>time_leap_years_up_to ()</title>
<indexterm zone="time-leap-years-up-to"><primary>time_leap_years_up_to</primary></indexterm><programlisting><link linkend="int">int</link>                 time_leap_years_up_to               (<link linkend="int">int</link> year);</programlisting>
<para>
Returns the number of leap years since year 1 up to (but not including) the
specified year. Year is the normal year, e.g. 2001.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>year</parameter>&nbsp;:</term>
<listitem><simpara> The year.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> number of leap years.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="isodate-from-time-t" role="function">
<title>isodate_from_time_t ()</title>
<indexterm zone="isodate-from-time-t"><primary>isodate_from_time_t</primary></indexterm><programlisting><link linkend="char">char</link>*               isodate_from_time_t                 (<link linkend="time-t">time_t</link> t);</programlisting>
<para>
Creates an ISO 8601 UTC representation from a time value.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>t</parameter>&nbsp;:</term>
<listitem><simpara> A time value.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> String with the ISO 8601 representation of the UTC time.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="time-from-isodate" role="function">
<title>time_from_isodate ()</title>
<indexterm zone="time-from-isodate"><primary>time_from_isodate</primary></indexterm><programlisting><link linkend="time-t">time_t</link>              time_from_isodate                   (const <link linkend="char">char</link> *str);</programlisting>
<para>
Converts an ISO 8601 UTC time string into a time_t value.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter>&nbsp;:</term>
<listitem><simpara> Date/time value in ISO 8601 format.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> Time_t corresponding to the specified ISO string.
Note that we only allow UTC times at present.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="time-add-day" role="function">
<title>time_add_day ()</title>
<indexterm zone="time-add-day"><primary>time_add_day</primary></indexterm><programlisting><link linkend="time-t">time_t</link>              time_add_day                        (<link linkend="time-t">time_t</link> time,
                                                         <link linkend="int">int</link> days);</programlisting>
<para>
Adds a day onto the time, using local time.
Note that if clocks go forward due to daylight savings time, there are
some non-existent local times, so the hour may be changed to make it a
valid time. This also means that it may not be wise to keep calling
<link linkend="time-add-day"><function>time_add_day()</function></link> to step through a certain period - if the hour gets changed
to make it valid time, any further calls to <link linkend="time-add-day"><function>time_add_day()</function></link> will also return
this hour, which may not be what you want.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>time</parameter>&nbsp;:</term>
<listitem><simpara> A time_t value.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>days</parameter>&nbsp;:</term>
<listitem><simpara> Number of days to add.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a time_t value containing <parameter>time</parameter> plus the days added.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="time-add-week" role="function">
<title>time_add_week ()</title>
<indexterm zone="time-add-week"><primary>time_add_week</primary></indexterm><programlisting><link linkend="time-t">time_t</link>              time_add_week                       (<link linkend="time-t">time_t</link> time,
                                                         <link linkend="int">int</link> weeks);</programlisting>
<para>
Adds the given number of weeks to a time value.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>time</parameter>&nbsp;:</term>
<listitem><simpara> A time_t value.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>weeks</parameter>&nbsp;:</term>
<listitem><simpara> Number of weeks to add.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a time_t value containing <parameter>time</parameter> plus the weeks added.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="time-day-begin" role="function">
<title>time_day_begin ()</title>
<indexterm zone="time-day-begin"><primary>time_day_begin</primary></indexterm><programlisting><link linkend="time-t">time_t</link>              time_day_begin                      (<link linkend="time-t">time_t</link> t);</programlisting>
<para>
Returns the start of the day, according to the local time.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>t</parameter>&nbsp;:</term>
<listitem><simpara> A time_t value.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the time corresponding to the beginning of the day.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="time-day-end" role="function">
<title>time_day_end ()</title>
<indexterm zone="time-day-end"><primary>time_day_end</primary></indexterm><programlisting><link linkend="time-t">time_t</link>              time_day_end                        (<link linkend="time-t">time_t</link> t);</programlisting>
<para>
Returns the end of the day, according to the local time.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>t</parameter>&nbsp;:</term>
<listitem><simpara> A time_t value.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the time corresponding to the end of the day.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="time-add-day-with-zone" role="function">
<title>time_add_day_with_zone ()</title>
<indexterm zone="time-add-day-with-zone"><primary>time_add_day_with_zone</primary></indexterm><programlisting><link linkend="time-t">time_t</link>              time_add_day_with_zone              (<link linkend="time-t">time_t</link> time,
                                                         <link linkend="int">int</link> days,
                                                         <link linkend="icaltimezone">icaltimezone</link> *zone);</programlisting>
<para>
Adds or subtracts a number of days to/from the given time_t value, using
the given timezone.
NOTE: this function is only here to make the transition to the timezone
functions easier. New code should use icaltimetype values and
<link linkend="icaltime-adjust"><function>icaltime_adjust()</function></link> to add or subtract days, hours, minutes &amp; seconds.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>time</parameter>&nbsp;:</term>
<listitem><simpara> A time_t value.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>days</parameter>&nbsp;:</term>
<listitem><simpara> Number of days to add.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>zone</parameter>&nbsp;:</term>
<listitem><simpara> Timezone to use.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a time_t value containing <parameter>time</parameter> plus the days added.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="time-add-week-with-zone" role="function">
<title>time_add_week_with_zone ()</title>
<indexterm zone="time-add-week-with-zone"><primary>time_add_week_with_zone</primary></indexterm><programlisting><link linkend="time-t">time_t</link>              time_add_week_with_zone             (<link linkend="time-t">time_t</link> time,
                                                         <link linkend="int">int</link> weeks,
                                                         <link linkend="icaltimezone">icaltimezone</link> *zone);</programlisting>
<para>
Adds or subtracts a number of weeks to/from the given time_t value, using
the given timezone.
NOTE: this function is only here to make the transition to the timezone
functions easier. New code should use icaltimetype values and
<link linkend="icaltime-adjust"><function>icaltime_adjust()</function></link> to add or subtract days, hours, minutes &amp; seconds.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>time</parameter>&nbsp;:</term>
<listitem><simpara> A time_t value.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>weeks</parameter>&nbsp;:</term>
<listitem><simpara> Number of weeks to add.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>zone</parameter>&nbsp;:</term>
<listitem><simpara> Timezone to use.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a time_t value containing <parameter>time</parameter> plus the weeks added.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="time-add-month-with-zone" role="function">
<title>time_add_month_with_zone ()</title>
<indexterm zone="time-add-month-with-zone"><primary>time_add_month_with_zone</primary></indexterm><programlisting><link linkend="time-t">time_t</link>              time_add_month_with_zone            (<link linkend="time-t">time_t</link> time,
                                                         <link linkend="int">int</link> months,
                                                         <link linkend="icaltimezone">icaltimezone</link> *zone);</programlisting>
<para>
Adds or subtracts a number of months to/from the given time_t value, using
the given timezone.
</para>
<para>
If the day would be off the end of the month (e.g. adding 1 month to
30th January, would lead to an invalid day, 30th February), it moves it
down to the last day in the month, e.g. 28th Feb (or 29th in a leap year.)
</para>
<para>
NOTE: this function is only here to make the transition to the timezone
functions easier. New code should use icaltimetype values and
<link linkend="icaltime-adjust"><function>icaltime_adjust()</function></link> to add or subtract days, hours, minutes &amp; seconds.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>time</parameter>&nbsp;:</term>
<listitem><simpara> A time_t value.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>months</parameter>&nbsp;:</term>
<listitem><simpara> Number of months to add.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>zone</parameter>&nbsp;:</term>
<listitem><simpara> Timezone to use.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a time_t value containing <parameter>time</parameter> plus the months added.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="time-year-begin-with-zone" role="function">
<title>time_year_begin_with_zone ()</title>
<indexterm zone="time-year-begin-with-zone"><primary>time_year_begin_with_zone</primary></indexterm><programlisting><link linkend="time-t">time_t</link>              time_year_begin_with_zone           (<link linkend="time-t">time_t</link> time,
                                                         <link linkend="icaltimezone">icaltimezone</link> *zone);</programlisting>
<para>
Returns the start of the year containing the given time_t, using the given
timezone.
NOTE: this function is only here to make the transition to the timezone
functions easier. New code should use icaltimetype values and
<link linkend="icaltime-adjust"><function>icaltime_adjust()</function></link> to add or subtract days, hours, minutes &amp; seconds.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>time</parameter>&nbsp;:</term>
<listitem><simpara> A time_t value.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>zone</parameter>&nbsp;:</term>
<listitem><simpara> Timezone to use.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the beginning of the year.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="time-month-begin-with-zone" role="function">
<title>time_month_begin_with_zone ()</title>
<indexterm zone="time-month-begin-with-zone"><primary>time_month_begin_with_zone</primary></indexterm><programlisting><link linkend="time-t">time_t</link>              time_month_begin_with_zone          (<link linkend="time-t">time_t</link> time,
                                                         <link linkend="icaltimezone">icaltimezone</link> *zone);</programlisting>
<para>
Returns the start of the month containing the given time_t, using the given
timezone.
NOTE: this function is only here to make the transition to the timezone
functions easier. New code should use icaltimetype values and
<link linkend="icaltime-adjust"><function>icaltime_adjust()</function></link> to add or subtract days, hours, minutes &amp; seconds.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>time</parameter>&nbsp;:</term>
<listitem><simpara> A time_t value.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>zone</parameter>&nbsp;:</term>
<listitem><simpara> Timezone to use.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the beginning of the month.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="time-week-begin-with-zone" role="function">
<title>time_week_begin_with_zone ()</title>
<indexterm zone="time-week-begin-with-zone"><primary>time_week_begin_with_zone</primary></indexterm><programlisting><link linkend="time-t">time_t</link>              time_week_begin_with_zone           (<link linkend="time-t">time_t</link> time,
                                                         <link linkend="int">int</link> week_start_day,
                                                         <link linkend="icaltimezone">icaltimezone</link> *zone);</programlisting>
<para>
Returns the start of the week containing the given time_t, using the given
timezone. week_start_day should use the same values as <link linkend="mktime"><function>mktime()</function></link>,
i.e. 0 (Sun) to 6 (Sat).
NOTE: this function is only here to make the transition to the timezone
functions easier. New code should use icaltimetype values and
<link linkend="icaltime-adjust"><function>icaltime_adjust()</function></link> to add or subtract days, hours, minutes &amp; seconds.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>time</parameter>&nbsp;:</term>
<listitem><simpara> A time_t value.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>week_start_day</parameter>&nbsp;:</term>
<listitem><simpara> Day to use as the starting of the week.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>zone</parameter>&nbsp;:</term>
<listitem><simpara> Timezone to use.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the beginning of the week.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="time-day-begin-with-zone" role="function">
<title>time_day_begin_with_zone ()</title>
<indexterm zone="time-day-begin-with-zone"><primary>time_day_begin_with_zone</primary></indexterm><programlisting><link linkend="time-t">time_t</link>              time_day_begin_with_zone            (<link linkend="time-t">time_t</link> time,
                                                         <link linkend="icaltimezone">icaltimezone</link> *zone);</programlisting>
<para>
Returns the start of the day containing the given time_t, using the given
timezone.
NOTE: this function is only here to make the transition to the timezone
functions easier. New code should use icaltimetype values and
<link linkend="icaltime-adjust"><function>icaltime_adjust()</function></link> to add or subtract days, hours, minutes &amp; seconds.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>time</parameter>&nbsp;:</term>
<listitem><simpara> A time_t value.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>zone</parameter>&nbsp;:</term>
<listitem><simpara> Timezone to use.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the beginning of the day.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="time-day-end-with-zone" role="function">
<title>time_day_end_with_zone ()</title>
<indexterm zone="time-day-end-with-zone"><primary>time_day_end_with_zone</primary></indexterm><programlisting><link linkend="time-t">time_t</link>              time_day_end_with_zone              (<link linkend="time-t">time_t</link> time,
                                                         <link linkend="icaltimezone">icaltimezone</link> *zone);</programlisting>
<para>
Returns the end of the day containing the given time_t, using the given
timezone. (The end of the day is the start of the next day.)
NOTE: this function is only here to make the transition to the timezone
functions easier. New code should use icaltimetype values and
<link linkend="icaltime-adjust"><function>icaltime_adjust()</function></link> to add or subtract days, hours, minutes &amp; seconds.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>time</parameter>&nbsp;:</term>
<listitem><simpara> A time_t value.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>zone</parameter>&nbsp;:</term>
<listitem><simpara> Timezone to use.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the end of the day.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="time-to-gdate-with-zone" role="function">
<title>time_to_gdate_with_zone ()</title>
<indexterm zone="time-to-gdate-with-zone"><primary>time_to_gdate_with_zone</primary></indexterm><programlisting><link linkend="void">void</link>                time_to_gdate_with_zone             (<link linkend="GDate">GDate</link> *date,
                                                         <link linkend="time-t">time_t</link> time,
                                                         <link linkend="icaltimezone">icaltimezone</link> *zone);</programlisting>
<para>
Converts a time_t value to a <link linkend="GDate"><type>GDate</type></link> structure using the specified timezone.
This is analogous to <link linkend="g-date-set-time"><function>g_date_set_time()</function></link> but takes the timezone into account.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>date</parameter>&nbsp;:</term>
<listitem><simpara> Destination <link linkend="GDate"><type>GDate</type></link> value.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>time</parameter>&nbsp;:</term>
<listitem><simpara> A time value.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>zone</parameter>&nbsp;:</term>
<listitem><simpara> Desired timezone for destination <parameter>date</parameter>, or NULL if the UTC timezone
is desired.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="icaltimetype-to-tm" role="function">
<title>icaltimetype_to_tm ()</title>
<indexterm zone="icaltimetype-to-tm"><primary>icaltimetype_to_tm</primary></indexterm><programlisting>struct <link linkend="tm">tm</link>           icaltimetype_to_tm                  (<link linkend="struct-icaltimetype">struct icaltimetype</link> *itt);</programlisting>
<para>
Convers an icaltimetype structure into a GLibc's struct tm.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>itt</parameter>&nbsp;:</term>
<listitem><simpara> An icaltimetype structure.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> The converted time as a struct tm. All fields will be
set properly except for tm.tm_yday.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="icaltimetype-to-tm-with-zone" role="function">
<title>icaltimetype_to_tm_with_zone ()</title>
<indexterm zone="icaltimetype-to-tm-with-zone"><primary>icaltimetype_to_tm_with_zone</primary></indexterm><programlisting>struct <link linkend="tm">tm</link>           icaltimetype_to_tm_with_zone        (<link linkend="struct-icaltimetype">struct icaltimetype</link> *itt,
                                                         <link linkend="icaltimezone">icaltimezone</link> *from_zone,
                                                         <link linkend="icaltimezone">icaltimezone</link> *to_zone);</programlisting>
<para>
Converts a time value from one timezone to another, and returns a struct tm
representation of the time.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>itt</parameter>&nbsp;:</term>
<listitem><simpara> A time value.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>from_zone</parameter>&nbsp;:</term>
<listitem><simpara> Source timezone.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>to_zone</parameter>&nbsp;:</term>
<listitem><simpara> Destination timezone.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> The converted time as a struct tm. All fields will be
set properly except for tm.tm_yday.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="tm-to-icaltimetype" role="function">
<title>tm_to_icaltimetype ()</title>
<indexterm zone="tm-to-icaltimetype"><primary>tm_to_icaltimetype</primary></indexterm><programlisting>struct <link linkend="icaltimetype">icaltimetype</link> tm_to_icaltimetype                  (<link linkend="struct-tm">struct tm</link> *tm,
                                                         <link linkend="gboolean">gboolean</link> is_date);</programlisting>
<para>
Converts a struct tm into an icaltimetype.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>tm</parameter>&nbsp;:</term>
<listitem><simpara> A struct tm.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>is_date</parameter>&nbsp;:</term>
<listitem><simpara> Whether the given time is a date only or not.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> The converted time as an icaltimetype.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
