summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllen Winter <allen.winter@kdab.com>2017-10-03 08:36:19 -0400
committerAllen Winter <allen.winter@kdab.com>2017-10-03 08:36:19 -0400
commitdb400cebd31013fb80c1104df8b164e8156b837d (patch)
treebb9607ae5d49e777b64a45f1a181bf77dba03a54
parentc452816ee23341d92ba9e1dbb43bada6502b69dd (diff)
parentbfceb32fcad57251a78c402b30c9d72586650488 (diff)
downloadlibical-git-db400cebd31013fb80c1104df8b164e8156b837d.tar.gz
Merge branch 'remove-is_utc' of https://github.com/ksuther/libical into ksuther-remove-is_utc
-rw-r--r--doc/UsingLibical.txt7
-rw-r--r--src/java/ICalTimeType.java10
-rw-r--r--src/java/jniICalPeriodType_cxx.cpp4
-rw-r--r--src/java/jniICalRecurrenceType_cxx.cpp2
-rw-r--r--src/java/jniICalTimeType_cxx.cpp14
-rw-r--r--src/java/jniICalTimeType_cxx.h2
-rw-r--r--src/java/jniICalTriggerType_cxx.cpp2
-rw-r--r--src/java/testjni.java8
-rw-r--r--src/libical-glib/api/i-cal-timetype.xml16
-rw-r--r--src/libical/icaltime.c30
-rw-r--r--src/libical/icaltime.h2
-rw-r--r--src/libical/icaltimezone.c5
-rw-r--r--src/libical/icaltz-util.c10
-rw-r--r--src/libicalss/icalclassify.c2
-rw-r--r--src/libicalvcal/icalvcal.c11
-rw-r--r--src/python/LibicalWrap_icaltime.i1
-rw-r--r--src/test/regression.c5
17 files changed, 29 insertions, 102 deletions
diff --git a/doc/UsingLibical.txt b/doc/UsingLibical.txt
index 688898da..9eecded4 100644
--- a/doc/UsingLibical.txt
+++ b/doc/UsingLibical.txt
@@ -839,13 +839,10 @@ struct icaltimetype {
int second;
- int is_utc; /* 1-> time is in UTC timezone */
-
int is_date; /* 1 -> interpret this as date. */ };
The year, month, day, hour, minute and second fields hold the broken-out
-time values. The is_utc field distinguishes between times in UTC and
-a local time zone. The is_date field indicates if the time should
+time values. The is_date field indicates if the time should
be interpreted only as a date. If it is a date, the hour, minute and
second fields are assumed to be zero, regardless of their actual vaules.
@@ -1365,8 +1362,6 @@ struct icaltimetype
int second;
- int is_utc;
-
int is_date;
const char* zone;
diff --git a/src/java/ICalTimeType.java b/src/java/ICalTimeType.java
index cf4ee407..15cf8715 100644
--- a/src/java/ICalTimeType.java
+++ b/src/java/ICalTimeType.java
@@ -79,15 +79,6 @@ public class ICalTimeType
return second;
}
- public void setIs_utc(boolean lcl_arg0)
- {
- is_utc = lcl_arg0 ? 1 : 0;
- }
- public boolean getIs_utc()
- {
- return is_utc == 0 ? false : true;
- }
-
public void setIs_date(boolean lcl_arg0)
{
is_date = lcl_arg0 ? 1 : 0;
@@ -138,7 +129,6 @@ public class ICalTimeType
private int hour;
private int minute;
private int second;
- private int is_utc;
private int is_date;
private String zone = new String(); // Converted from char*
}
diff --git a/src/java/jniICalPeriodType_cxx.cpp b/src/java/jniICalPeriodType_cxx.cpp
index 4cfbfe82..3f4ea10a 100644
--- a/src/java/jniICalPeriodType_cxx.cpp
+++ b/src/java/jniICalPeriodType_cxx.cpp
@@ -44,7 +44,6 @@ void jni_SetStart_in_ICalPeriodType(struct ICalPeriodType* __ICalPeriodType_, J
jni_SetHour_in_ICalTimeType(&(__ICalPeriodType_->start), env, lcl_jobj0);
jni_SetMinute_in_ICalTimeType(&(__ICalPeriodType_->start), env, lcl_jobj0);
jni_SetSecond_in_ICalTimeType(&(__ICalPeriodType_->start), env, lcl_jobj0);
- jni_SetIs_utc_in_ICalTimeType(&(__ICalPeriodType_->start), env, lcl_jobj0);
jni_SetIs_date_in_ICalTimeType(&(__ICalPeriodType_->start), env, lcl_jobj0);
jni_SetZone_in_ICalTimeType(&(__ICalPeriodType_->start), env, lcl_jobj0);
}
@@ -59,7 +58,6 @@ void jni_GetStart_from_ICalPeriodType(struct ICalPeriodType* __ICalPeriodType_,
jni_GetHour_from_ICalTimeType(&(__ICalPeriodType_->start), env, lcl_jobj0);
jni_GetMinute_from_ICalTimeType(&(__ICalPeriodType_->start), env, lcl_jobj0);
jni_GetSecond_from_ICalTimeType(&(__ICalPeriodType_->start), env, lcl_jobj0);
- jni_GetIs_utc_from_ICalTimeType(&(__ICalPeriodType_->start), env, lcl_jobj0);
jni_GetIs_date_from_ICalTimeType(&(__ICalPeriodType_->start), env, lcl_jobj0);
jni_GetZone_from_ICalTimeType(&(__ICalPeriodType_->start), env, lcl_jobj0);
}
@@ -74,7 +72,6 @@ void jni_SetEnd_in_ICalPeriodType(struct ICalPeriodType* __ICalPeriodType_, JNI
jni_SetHour_in_ICalTimeType(&(__ICalPeriodType_->end), env, lcl_jobj0);
jni_SetMinute_in_ICalTimeType(&(__ICalPeriodType_->end), env, lcl_jobj0);
jni_SetSecond_in_ICalTimeType(&(__ICalPeriodType_->end), env, lcl_jobj0);
- jni_SetIs_utc_in_ICalTimeType(&(__ICalPeriodType_->end), env, lcl_jobj0);
jni_SetIs_date_in_ICalTimeType(&(__ICalPeriodType_->end), env, lcl_jobj0);
jni_SetZone_in_ICalTimeType(&(__ICalPeriodType_->end), env, lcl_jobj0);
}
@@ -89,7 +86,6 @@ void jni_GetEnd_from_ICalPeriodType(struct ICalPeriodType* __ICalPeriodType_, JN
jni_GetHour_from_ICalTimeType(&(__ICalPeriodType_->end), env, lcl_jobj0);
jni_GetMinute_from_ICalTimeType(&(__ICalPeriodType_->end), env, lcl_jobj0);
jni_GetSecond_from_ICalTimeType(&(__ICalPeriodType_->end), env, lcl_jobj0);
- jni_GetIs_utc_from_ICalTimeType(&(__ICalPeriodType_->end), env, lcl_jobj0);
jni_GetIs_date_from_ICalTimeType(&(__ICalPeriodType_->end), env, lcl_jobj0);
jni_GetZone_from_ICalTimeType(&(__ICalPeriodType_->end), env, lcl_jobj0);
}
diff --git a/src/java/jniICalRecurrenceType_cxx.cpp b/src/java/jniICalRecurrenceType_cxx.cpp
index af4c112c..9b463301 100644
--- a/src/java/jniICalRecurrenceType_cxx.cpp
+++ b/src/java/jniICalRecurrenceType_cxx.cpp
@@ -64,7 +64,6 @@ void jni_SetUntil_in_ICalRecurrenceType(struct ICalRecurrenceType* __ICalRecurr
jni_SetHour_in_ICalTimeType(&(__ICalRecurrenceType_->until), env, lcl_jobj0);
jni_SetMinute_in_ICalTimeType(&(__ICalRecurrenceType_->until), env, lcl_jobj0);
jni_SetSecond_in_ICalTimeType(&(__ICalRecurrenceType_->until), env, lcl_jobj0);
- jni_SetIs_utc_in_ICalTimeType(&(__ICalRecurrenceType_->until), env, lcl_jobj0);
jni_SetIs_date_in_ICalTimeType(&(__ICalRecurrenceType_->until), env, lcl_jobj0);
jni_SetZone_in_ICalTimeType(&(__ICalRecurrenceType_->until), env, lcl_jobj0);
}
@@ -79,7 +78,6 @@ void jni_GetUntil_from_ICalRecurrenceType(struct ICalRecurrenceType* __ICalRecur
jni_GetHour_from_ICalTimeType(&(__ICalRecurrenceType_->until), env, lcl_jobj0);
jni_GetMinute_from_ICalTimeType(&(__ICalRecurrenceType_->until), env, lcl_jobj0);
jni_GetSecond_from_ICalTimeType(&(__ICalRecurrenceType_->until), env, lcl_jobj0);
- jni_GetIs_utc_from_ICalTimeType(&(__ICalRecurrenceType_->until), env, lcl_jobj0);
jni_GetIs_date_from_ICalTimeType(&(__ICalRecurrenceType_->until), env, lcl_jobj0);
jni_GetZone_from_ICalTimeType(&(__ICalRecurrenceType_->until), env, lcl_jobj0);
}
diff --git a/src/java/jniICalTimeType_cxx.cpp b/src/java/jniICalTimeType_cxx.cpp
index b4012aa9..8ee2d694 100644
--- a/src/java/jniICalTimeType_cxx.cpp
+++ b/src/java/jniICalTimeType_cxx.cpp
@@ -27,7 +27,6 @@ static jfieldID ICalTimeType_Day_FID;
static jfieldID ICalTimeType_Hour_FID;
static jfieldID ICalTimeType_Minute_FID;
static jfieldID ICalTimeType_Second_FID;
-static jfieldID ICalTimeType_Is_utc_FID;
static jfieldID ICalTimeType_Is_date_FID;
static jfieldID ICalTimeType_Zone_FID;
@@ -40,7 +39,6 @@ void initICalTimeTypeFieldIDs(JNIEnv* env, jclass clazz)
ICalTimeType_Hour_FID = env->GetFieldID(clazz, "hour", "I");
ICalTimeType_Minute_FID = env->GetFieldID(clazz, "minute", "I");
ICalTimeType_Second_FID = env->GetFieldID(clazz, "second", "I");
- ICalTimeType_Is_utc_FID = env->GetFieldID(clazz, "is_utc", "I");
ICalTimeType_Is_date_FID = env->GetFieldID(clazz, "is_date", "I");
ICalTimeType_Zone_FID = env->GetFieldID(clazz, "zone", "Ljava/lang/String;");
}
@@ -105,16 +103,6 @@ void jni_GetSecond_from_ICalTimeType(struct ICalTimeType* __ICalTimeType_, JNIEn
__ICalTimeType_->second = env->GetIntField(thisICalTimeType, ICalTimeType_Second_FID);
}
-void jni_SetIs_utc_in_ICalTimeType(struct ICalTimeType* __ICalTimeType_, JNIEnv *env, jobject thisICalTimeType)
-{
- env->SetIntField(thisICalTimeType, ICalTimeType_Is_utc_FID, (jint) __ICalTimeType_->is_utc);
-}
-
-void jni_GetIs_utc_from_ICalTimeType(struct ICalTimeType* __ICalTimeType_, JNIEnv *env, jobject thisICalTimeType)
-{
- __ICalTimeType_->is_utc = env->GetIntField(thisICalTimeType, ICalTimeType_Is_utc_FID);
-}
-
void jni_SetIs_date_in_ICalTimeType(struct ICalTimeType* __ICalTimeType_, JNIEnv *env, jobject thisICalTimeType)
{
env->SetIntField(thisICalTimeType, ICalTimeType_Is_date_FID, (jint) __ICalTimeType_->is_date);
@@ -144,7 +132,6 @@ void jni_SetAll_in_ICalTimeType(struct ICalTimeType* __ICalTimeType_, JNIEnv* en
jni_SetHour_in_ICalTimeType(__ICalTimeType_, env, thisICalTimeType);
jni_SetMinute_in_ICalTimeType(__ICalTimeType_, env, thisICalTimeType);
jni_SetSecond_in_ICalTimeType(__ICalTimeType_, env, thisICalTimeType);
- jni_SetIs_utc_in_ICalTimeType(__ICalTimeType_, env, thisICalTimeType);
jni_SetIs_date_in_ICalTimeType(__ICalTimeType_, env, thisICalTimeType);
jni_SetZone_in_ICalTimeType(__ICalTimeType_, env, thisICalTimeType);
}
@@ -158,7 +145,6 @@ void jni_GetAll_from_ICalTimeType(struct ICalTimeType* __ICalTimeType_, JNIEnv*
jni_GetHour_from_ICalTimeType(__ICalTimeType_, env, thisICalTimeType);
jni_GetMinute_from_ICalTimeType(__ICalTimeType_, env, thisICalTimeType);
jni_GetSecond_from_ICalTimeType(__ICalTimeType_, env, thisICalTimeType);
- jni_GetIs_utc_from_ICalTimeType(__ICalTimeType_, env, thisICalTimeType);
jni_GetIs_date_from_ICalTimeType(__ICalTimeType_, env, thisICalTimeType);
jni_GetZone_from_ICalTimeType(__ICalTimeType_, env, thisICalTimeType);
}
diff --git a/src/java/jniICalTimeType_cxx.h b/src/java/jniICalTimeType_cxx.h
index f74b6f80..06428398 100644
--- a/src/java/jniICalTimeType_cxx.h
+++ b/src/java/jniICalTimeType_cxx.h
@@ -42,8 +42,6 @@ void jni_SetMinute_in_ICalTimeType(struct ICalTimeType* __ICalTimeType_, JNIEnv
void jni_GetMinute_from_ICalTimeType(struct ICalTimeType* __ICalTimeType_, JNIEnv *env, jobject thisICalTimeType);
void jni_SetSecond_in_ICalTimeType(struct ICalTimeType* __ICalTimeType_, JNIEnv *env, jobject thisICalTimeType);
void jni_GetSecond_from_ICalTimeType(struct ICalTimeType* __ICalTimeType_, JNIEnv *env, jobject thisICalTimeType);
-void jni_SetIs_utc_in_ICalTimeType(struct ICalTimeType* __ICalTimeType_, JNIEnv *env, jobject thisICalTimeType);
-void jni_GetIs_utc_from_ICalTimeType(struct ICalTimeType* __ICalTimeType_, JNIEnv *env, jobject thisICalTimeType);
void jni_SetIs_date_in_ICalTimeType(struct ICalTimeType* __ICalTimeType_, JNIEnv *env, jobject thisICalTimeType);
void jni_GetIs_date_from_ICalTimeType(struct ICalTimeType* __ICalTimeType_, JNIEnv *env, jobject thisICalTimeType);
void jni_SetZone_in_ICalTimeType(struct ICalTimeType* __ICalTimeType_, JNIEnv *env, jobject thisICalTimeType);
diff --git a/src/java/jniICalTriggerType_cxx.cpp b/src/java/jniICalTriggerType_cxx.cpp
index c8718e11..7b9d860c 100644
--- a/src/java/jniICalTriggerType_cxx.cpp
+++ b/src/java/jniICalTriggerType_cxx.cpp
@@ -41,7 +41,6 @@ void jni_SetTime_in_ICalTriggerType(struct ICalTriggerType* __ICalTriggerType_,
jni_SetHour_in_ICalTimeType(&(__ICalTriggerType_->time), env, lcl_jobj0);
jni_SetMinute_in_ICalTimeType(&(__ICalTriggerType_->time), env, lcl_jobj0);
jni_SetSecond_in_ICalTimeType(&(__ICalTriggerType_->time), env, lcl_jobj0);
- jni_SetIs_utc_in_ICalTimeType(&(__ICalTriggerType_->time), env, lcl_jobj0);
jni_SetIs_date_in_ICalTimeType(&(__ICalTriggerType_->time), env, lcl_jobj0);
jni_SetZone_in_ICalTimeType(&(__ICalTriggerType_->time), env, lcl_jobj0);
}
@@ -56,7 +55,6 @@ void jni_GetTime_from_ICalTriggerType(struct ICalTriggerType* __ICalTriggerType_
jni_GetHour_from_ICalTimeType(&(__ICalTriggerType_->time), env, lcl_jobj0);
jni_GetMinute_from_ICalTimeType(&(__ICalTriggerType_->time), env, lcl_jobj0);
jni_GetSecond_from_ICalTimeType(&(__ICalTriggerType_->time), env, lcl_jobj0);
- jni_GetIs_utc_from_ICalTimeType(&(__ICalTriggerType_->time), env, lcl_jobj0);
jni_GetIs_date_from_ICalTimeType(&(__ICalTriggerType_->time), env, lcl_jobj0);
jni_GetZone_from_ICalTimeType(&(__ICalTriggerType_->time), env, lcl_jobj0);
}
diff --git a/src/java/testjni.java b/src/java/testjni.java
index a7eb5886..d90c327b 100644
--- a/src/java/testjni.java
+++ b/src/java/testjni.java
@@ -37,7 +37,7 @@ public class testjni
starttime.setHour(18);
starttime.setMinute(0);
starttime.setSecond(0);
- starttime.setIs_utc(true);
+ starttime.setZone("UTC");
System.out.println("done creating starttime");
ICalTimeType endtime = new ICalTimeType();
@@ -47,7 +47,7 @@ public class testjni
endtime.setHour(8);
endtime.setMinute(0);
endtime.setSecond(0);
- endtime.setIs_utc(true);
+ endtime.setZone("UTC");
System.out.println("done creating endtime");
@@ -258,7 +258,7 @@ public class testjni
time_tma.setHour(2);
time_tma.setMinute(2);
time_tma.setSecond(2);
- time_tma.setIs_utc(true);
+ time_tma.setZone("UTC");
ic.set_recurrenceid(time_tma);
@@ -299,7 +299,7 @@ public class testjni
duetime.setHour(18);
duetime.setMinute(0);
duetime.setSecond(0);
- duetime.setIs_utc(true);
+ duetime.setZone("UTC");
System.out.println("done creating duetime");
statusProp.set_status(ICalProperty.ICalPropertyStatus.ICAL_STATUS_COMPLETED);
diff --git a/src/libical-glib/api/i-cal-timetype.xml b/src/libical-glib/api/i-cal-timetype.xml
index 01e80853..685a9400 100644
--- a/src/libical-glib/api/i-cal-timetype.xml
+++ b/src/libical-glib/api/i-cal-timetype.xml
@@ -24,10 +24,9 @@
timetype.hour = 0;
timetype.minute = 0;
timetype.second = 0;
- timetype.is_utc = 1;
timetype.is_date = 0;
timetype.is_daylight = 0;
- timetype.zone = NULL;
+ timetype.zone = icaltimezone_get_utc_timezone();
return timetype;</custom>
</method>
<method name="i_cal_timetype_new" corresponds="CUSTOM" kind="constructor" since="1.0">
@@ -121,17 +120,10 @@
</method>
<method name="i_cal_timetype_is_utc" corresponds="CUSTOM" kind="get" since="1.0">
<parameter type="ICalTimetype *" name="timetype" comment="The #ICalTimetype to be queried."/>
- <returns type="gint" comment="The is_utc." />
- <comment xml:space="preserve">Get the is_utc of #ICalTimetype.</comment>
+ <returns type="gint" comment="If the time is in UTC." />
+ <comment xml:space="preserve">Get if the #ICalTimetype is in UTC.</comment>
<custom> g_return_val_if_fail (timetype != NULL, 0);
- return ((struct icaltimetype *)i_cal_object_get_native ((ICalObject *)timetype))->is_utc;</custom>
- </method>
- <method name="i_cal_timetype_set_is_utc" corresponds="CUSTOM" kind="set" since="1.0">
- <parameter type="ICalTimetype *" name="timetype" comment="The #ICalTimetype to be set."/>
- <parameter type="gint" name="is_utc" comment="The is_utc."/>
- <comment>Set the is_utc of #ICalTimetype.</comment>
- <custom> g_return_if_fail (timetype != NULL &amp;&amp; I_CAL_IS_TIMETYPE (timetype));
- ((struct icaltimetype *)i_cal_object_get_native ((ICalObject *)timetype))->is_utc = is_utc;</custom>
+ return icaltime_is_utc(*(struct icaltimetype *)i_cal_object_get_native ((ICalObject *)timetype));</custom>
</method>
<method name="i_cal_timetype_is_date" corresponds="CUSTOM" kind="get" since="1.0">
<parameter type="ICalTimetype *" name="timetype" comment="The #ICalTimetype to be queried."/>
diff --git a/src/libical/icaltime.c b/src/libical/icaltime.c
index 32b73160..cace5eb9 100644
--- a/src/libical/icaltime.c
+++ b/src/libical/icaltime.c
@@ -225,9 +225,8 @@ struct icaltimetype icaltime_from_timet_with_zone(const time_t tm, const int is_
tt.minute = t.tm_min;
tt.second = t.tm_sec;
tt.is_date = 0;
- tt.is_utc = (zone == utc_zone) ? 1 : 0;
tt.is_daylight = 0;
- tt.zone = NULL;
+ tt.zone = (zone == NULL) ? NULL : utc_zone;
/* Use our timezone functions to convert to the required timezone. */
icaltimezone_convert_time(&tt, utc_zone, (icaltimezone *) zone);
@@ -366,7 +365,7 @@ char *icaltime_as_ical_string_r(const struct icaltimetype tt)
} else {
const char *fmt;
- if (tt.is_utc) {
+ if (icaltime_is_utc(tt)) {
fmt = "%04d%02d%02dT%02d%02d%02dZ";
} else {
fmt = "%04d%02d%02dT%02d%02d%02d";
@@ -413,17 +412,14 @@ struct icaltimetype icaltime_from_string(const char *str)
size = strlen(str);
if ((size == 15) || (size == 19)) { /* floating time with/without separators */
- tt.is_utc = 0;
tt.is_date = 0;
} else if ((size == 16) || (size == 20)) { /* UTC time, ends in 'Z' */
if ((str[size-1] != 'Z'))
goto FAIL;
- tt.is_utc = 1;
tt.zone = icaltimezone_get_utc_timezone();
tt.is_date = 0;
} else if ((size == 8) || (size == 10)) { /* A DATE */
- tt.is_utc = 0;
tt.is_date = 1;
} else { /* error */
goto FAIL;
@@ -689,8 +685,7 @@ struct icaltimetype icaltime_null_date(void)
*/
int icaltime_is_valid_time(const struct icaltimetype t)
{
- if (t.is_utc > 1 || t.is_utc < 0 ||
- t.year < 0 || t.year > 3000 || t.is_date > 1 || t.is_date < 0) {
+ if (t.year < 0 || t.year > 3000 || t.is_date > 1 || t.is_date < 0) {
return 0;
} else {
return 1;
@@ -710,7 +705,7 @@ int icaltime_is_date(const struct icaltimetype t)
*/
int icaltime_is_utc(const struct icaltimetype t)
{
- return t.is_utc;
+ return t.zone == icaltimezone_get_utc_timezone();
}
/**
@@ -737,10 +732,7 @@ int icaltime_compare(const struct icaltimetype a_in, const struct icaltimetype b
/* We only need to perform time zone conversion if times aren't in the same time zone
or neither of them is floating (zone equals NULL) */
- if ((a_in.zone != b_in.zone || a_in.is_utc != b_in.is_utc) &&
- ((a_in.zone != NULL && b_in.zone != NULL) ||
- (a_in.zone != NULL && b_in.is_utc) ||
- (a_in.is_utc && b_in.zone != NULL))) {
+ if (a_in.zone != b_in.zone && a_in.zone != NULL && b_in.zone != NULL) {
a = icaltime_convert_to_zone(a_in, icaltimezone_get_utc_timezone());
b = icaltime_convert_to_zone(b_in, icaltimezone_get_utc_timezone());
} else {
@@ -979,7 +971,7 @@ struct icaltimetype icaltime_convert_to_zone(const struct icaltimetype tt, icalt
}
/* If it's a floating time we don't want to adjust the time */
- if (tt.zone != NULL || tt.is_utc) {
+ if (tt.zone != NULL) {
icaltimezone *from_zone = (icaltimezone *) tt.zone;
if (!from_zone) {
@@ -990,11 +982,6 @@ struct icaltimetype icaltime_convert_to_zone(const struct icaltimetype tt, icalt
}
ret.zone = zone;
- if (zone == icaltimezone_get_utc_timezone()) {
- ret.is_utc = 1;
- } else {
- ret.is_utc = 0;
- }
return ret;
}
@@ -1031,11 +1018,6 @@ struct icaltimetype icaltime_set_timezone(struct icaltimetype *t, const icaltime
}
t->zone = zone;
- if (zone == icaltimezone_get_utc_timezone()) {
- t->is_utc = 1;
- } else {
- t->is_utc = 0;
- }
return *t;
}
diff --git a/src/libical/icaltime.h b/src/libical/icaltime.h
index 6f35b53f..2d7e2f8a 100644
--- a/src/libical/icaltime.h
+++ b/src/libical/icaltime.h
@@ -111,8 +111,6 @@ struct icaltimetype
int minute;
int second;
- int is_utc; /**< 1-> time is in UTC timezone */
-
int is_date; /**< 1 -> interpret this as date. */
int is_daylight; /**< 1 -> time is in daylight savings time. */
diff --git a/src/libical/icaltimezone.c b/src/libical/icaltimezone.c
index 5fa7531b..f5066822 100644
--- a/src/libical/icaltimezone.c
+++ b/src/libical/icaltimezone.c
@@ -624,7 +624,7 @@ void icaltimezone_expand_vtimezone(icalcomponent *comp, int end_year, icalarray
/* If the rrule UNTIL value is set and is in UTC, we convert it to
a local time, since the recurrence code has no way to convert
it itself. */
- if (!icaltime_is_null_time(rrule.until) && rrule.until.is_utc) {
+ if (!icaltime_is_null_time(rrule.until) && icaltime_is_utc(rrule.until)) {
#if 0
printf(" Found RRULE UNTIL in UTC.\n");
#endif
@@ -633,7 +633,7 @@ void icaltimezone_expand_vtimezone(icalcomponent *comp, int end_year, icalarray
since that is the offset from UTC that will be in effect
when each of the RRULE occurrences happens. */
icaltime_adjust(&rrule.until, 0, 0, 0, change.prev_utc_offset);
- rrule.until.is_utc = 0;
+ rrule.until.zone = NULL;
}
/* Add the dtstart to changes, otherwise some oddly-defined VTIMEZONE
@@ -1350,7 +1350,6 @@ static struct icaltimetype tm_to_icaltimetype(struct tm *tm)
itt.month = tm->tm_mon + 1;
itt.year = tm->tm_year + 1900;
- itt.is_utc = 0;
itt.is_date = 0;
return itt;
diff --git a/src/libical/icaltz-util.c b/src/libical/icaltz-util.c
index 1dfdf5eb..b86bdca3 100644
--- a/src/libical/icaltz-util.c
+++ b/src/libical/icaltz-util.c
@@ -456,7 +456,7 @@ icalcomponent *icaltzutil_fetch_timezone(const char *location)
types[prev_idx].gmtoff != prev_daylight_gmtoff) {
// Set UNTIL of the previous component's recurrence
icaltime_adjust(&prev_daylight_time, 0, 0, 0, -types[prev_idx].gmtoff);
- prev_daylight_time.is_utc = 1;
+ prev_daylight_time.zone = icaltimezone_get_utc_timezone();
daylight_recur.until = prev_daylight_time;
icalproperty_set_rrule(cur_daylight_rrule_property, daylight_recur);
@@ -489,7 +489,7 @@ icalcomponent *icaltzutil_fetch_timezone(const char *location)
standard_recur.by_day[0] != by_day ||
types[prev_idx].gmtoff != prev_standard_gmtoff) {
icaltime_adjust(&prev_standard_time, 0, 0, 0, -types[prev_idx].gmtoff);
- prev_standard_time.is_utc = 1;
+ prev_standard_time.zone = icaltimezone_get_utc_timezone();
standard_recur.until = prev_standard_time;
icalproperty_set_rrule(cur_standard_rrule_property, standard_recur);
@@ -503,7 +503,7 @@ icalcomponent *icaltzutil_fetch_timezone(const char *location)
if (cur_daylight_comp && daylight_recur.by_month[0] == icaltime.month &&
daylight_recur.by_day[0] == by_day) {
icaltime_adjust(&prev_daylight_time, 0, 0, 0, -types[prev_idx].gmtoff);
- prev_daylight_time.is_utc = 1;
+ prev_daylight_time.zone = icaltimezone_get_utc_timezone();
daylight_recur.until = prev_daylight_time;
icalproperty_set_rrule(cur_daylight_rrule_property, daylight_recur);
@@ -562,7 +562,7 @@ icalcomponent *icaltzutil_fetch_timezone(const char *location)
// and then insert a new component to indicate the time zone doesn't transition anymore
if (cur_daylight_comp && icaltime_as_timet(prev_daylight_time) < now) {
icaltime_adjust(&prev_prev_daylight_time, 0, 0, 0, -prev_daylight_gmtoff);
- prev_prev_daylight_time.is_utc = 1;
+ prev_prev_daylight_time.zone = icaltimezone_get_utc_timezone();
daylight_recur.until = prev_prev_daylight_time;
icalproperty_set_rrule(cur_daylight_rrule_property, daylight_recur);
@@ -581,7 +581,7 @@ icalcomponent *icaltzutil_fetch_timezone(const char *location)
if (cur_standard_comp && icaltime_as_timet(prev_standard_time) < now) {
icaltime_adjust(&prev_prev_standard_time, 0, 0, 0, -prev_standard_gmtoff);
- prev_prev_standard_time.is_utc = 1;
+ prev_prev_standard_time.zone = icaltimezone_get_utc_timezone();
standard_recur.until = prev_prev_standard_time;
icalproperty_set_rrule(cur_standard_rrule_property, standard_recur);
diff --git a/src/libicalss/icalclassify.c b/src/libicalss/icalclassify.c
index e7f8f52d..30536140 100644
--- a/src/libicalss/icalclassify.c
+++ b/src/libicalss/icalclassify.c
@@ -663,7 +663,7 @@ icalproperty_xlicclass icalclassify(icalcomponent *c, icalcomponent *match, cons
/* Determine if the incoming component is obsoleted by the match */
if (match != 0 && (comp_parts.method == ICAL_METHOD_REQUEST)) {
- assert(!((comp_parts.dtstamp.is_utc == 1) ^ (match_parts.dtstamp.is_utc == 1)));
+ assert(!((icaltime_is_utc(comp_parts.dtstamp) == 1) ^ (icaltime_is_utc(match_parts.dtstamp) == 1)));
if (comp_parts.sequence < match_parts.sequence &&
icaltime_compare(comp_parts.dtstamp, match_parts.dtstamp) > 0) {
diff --git a/src/libicalvcal/icalvcal.c b/src/libicalvcal/icalvcal.c
index fe1cf591..9acb8824 100644
--- a/src/libicalvcal/icalvcal.c
+++ b/src/libicalvcal/icalvcal.c
@@ -40,6 +40,7 @@
#include "icalvcal.h"
#include "icalerror.h"
#include "icalvalue.h"
+#include "icaltimezone.h"
#include "icalversion.h" /* for ICAL_PACKAGE */
#include <stddef.h> /* for ptrdiff_t */
@@ -147,8 +148,8 @@ static void convert_floating_time_to_utc(struct icaltimetype *itt)
itt->minute = utc_tm.tm_min;
itt->second = utc_tm.tm_sec;
- /* Set the is_utc flag. */
- itt->is_utc = 1;
+ /* Set the zone to UTC. */
+ itt->zone = icaltimezone_get_utc_timezone();
}
static void icalvcal_traverse_objects(VObject *,
@@ -302,7 +303,7 @@ static int get_alarm_properties(icalcomponent *comp, VObject *object,
t.duration = icaldurationtype_null_duration();
/* If it is a floating time, convert it to a UTC time. */
- if (!t.time.is_utc)
+ if (t.time.zone == NULL)
convert_floating_time_to_utc(&t.time);
/* Create a TRIGGER property. */
@@ -747,7 +748,7 @@ static void *utc_datetime_prop(int icaltype, VObject *object, icalcomponent *com
itt = icaltime_from_string(s);
/* If it is a floating time, convert it to a UTC time. */
- if (!itt.is_utc)
+ if (itt.zone == NULL)
convert_floating_time_to_utc(&itt);
value = icalvalue_new_datetime(itt);
@@ -845,7 +846,7 @@ static const char *rrule_parse_duration(const char *s, struct icalrecurrencetype
don't really know what timezone the vCalendar times are in. So if
it can be converted to a DATE value, we do that. Otherwise we just
use the current Unix timezone. Should be OK 99% of the time. */
- if (!recur->until.is_utc) {
+ if (!icaltime_is_utc(recur->until)) {
if (recur->until.hour == 0 &&
recur->until.minute == 0 &&
recur->until.second == 0) {
diff --git a/src/python/LibicalWrap_icaltime.i b/src/python/LibicalWrap_icaltime.i
index c1508089..43fc9127 100644
--- a/src/python/LibicalWrap_icaltime.i
+++ b/src/python/LibicalWrap_icaltime.i
@@ -164,7 +164,6 @@ def icaltimetype_from_datetime(dt):
if dt.tzinfo:
# TODO: convert to the right timezone, assume for now we are UTC
tt.zone = 0
- tt.is_utc = True
tt.is_date = False
tt.isdaylight = False
diff --git a/src/test/regression.c b/src/test/regression.c
index b68f5d35..63b95434 100644
--- a/src/test/regression.c
+++ b/src/test/regression.c
@@ -408,11 +408,6 @@ void test_icaltime_compare_utc_zone()
b = icaltime_from_string("20170130T103000");
b.zone = icaltimezone_get_builtin_timezone("America/Los_Angeles");
int_is("a < b", icaltime_compare(a, b), -1);
-
- /* test comparing times across time zones (where UTC is specified by is_utc and zone is NULL) */
- a.zone = NULL;
- int_is("a.is_utc", a.is_utc, 1);
- int_is("a < b", icaltime_compare(a, b), -1);
}
void test_parameters()