From fe7502356057b5f4379b4912ed633b162539d728 Mon Sep 17 00:00:00 2001 From: Kent Sutherland Date: Sun, 18 Dec 2016 15:10:26 -0600 Subject: Remove deprecated icaltime_from_timet Use icaltime_from_timet_with_zone instead. --- src/test/regression-component.c | 28 ++++++++++++++-------------- src/test/regression-recur.c | 2 +- src/test/regression-storage.c | 6 +++--- src/test/regression.c | 36 ++++++++++++++---------------------- 4 files changed, 32 insertions(+), 40 deletions(-) (limited to 'src/test') diff --git a/src/test/regression-component.c b/src/test/regression-component.c index 1a42273a..80167b5c 100644 --- a/src/test/regression-component.c +++ b/src/test/regression-component.c @@ -89,13 +89,13 @@ void create_new_component() icalcomponent *timezone; icalcomponent *tzc; icalcomponent *event; - struct icaltimetype atime = icaltime_from_timet(1023398689, 0); + struct icaltimetype atime = icaltime_from_timet_with_zone(1023398689, 0, NULL); struct icaldatetimeperiodtype rtime; icalproperty *property; char *calendar_as_string; - rtime.period.start = icaltime_from_timet(1023398689, 0); - rtime.period.end = icaltime_from_timet(1023409689, 0); + rtime.period.start = icaltime_from_timet_with_zone(1023398689, 0, NULL); + rtime.period.end = icaltime_from_timet_with_zone(1023409689, 0, NULL); rtime.period.end.hour++; rtime.time = icaltime_null_time(); @@ -215,11 +215,11 @@ void create_new_component() void create_new_component_with_va_args() { icalcomponent *calendar; - struct icaltimetype atime = icaltime_from_timet(time(0), 0); + struct icaltimetype atime = icaltime_from_timet_with_zone(time(0), 0, NULL); struct icaldatetimeperiodtype rtime; - rtime.period.start = icaltime_from_timet(time(0), 0); - rtime.period.end = icaltime_from_timet(time(0), 0); + rtime.period.start = icaltime_from_timet_with_zone(time(0), 0, NULL); + rtime.period.end = icaltime_from_timet_with_zone(time(0), 0, NULL); rtime.period.end.hour++; rtime.time = icaltime_null_time(); @@ -354,8 +354,8 @@ void test_icalcomponent_get_span() */ c = icalcomponent_vanew( ICAL_VEVENT_COMPONENT, - icalproperty_vanew_dtstart(icaltime_from_timet(tm1, 0), 0), - icalproperty_vanew_dtend(icaltime_from_timet(tm2, 0), 0), + icalproperty_vanew_dtstart(icaltime_from_timet_with_zone(tm1, 0, NULL), 0), + icalproperty_vanew_dtend(icaltime_from_timet_with_zone(tm2, 0, NULL), 0), (void *)0); span = icalcomponent_get_span(c); @@ -439,7 +439,7 @@ void test_icalcomponent_get_span() */ c = icalcomponent_vanew( ICAL_VEVENT_COMPONENT, - icalproperty_new_dtstart(icaltime_from_timet(tm1, 0)), + icalproperty_new_dtstart(icaltime_from_timet_with_zone(tm1, 0, NULL)), (void *)0); span = icalcomponent_get_span(c); @@ -454,8 +454,8 @@ void test_icalcomponent_get_span() */ c = icalcomponent_vanew( ICAL_VEVENT_COMPONENT, - icalproperty_new_dtstart(icaltime_from_timet(tm1, 1)), - icalproperty_new_dtend(icaltime_from_timet(tm1, 1)), + icalproperty_new_dtstart(icaltime_from_timet_with_zone(tm1, 1, NULL)), + icalproperty_new_dtend(icaltime_from_timet_with_zone(tm1, 1, NULL)), (void *)0); span = icalcomponent_get_span(c); @@ -469,8 +469,8 @@ void test_icalcomponent_get_span() * We specify start and end date */ c = icalcomponent_vanew(ICAL_VEVENT_COMPONENT, - icalproperty_new_dtstart(icaltime_from_timet(tm1, 1)), - icalproperty_new_dtend(icaltime_from_timet(tm2, 1)), (void *)0); + icalproperty_new_dtstart(icaltime_from_timet_with_zone(tm1, 1, NULL)), + icalproperty_new_dtend(icaltime_from_timet_with_zone(tm2, 1, NULL)), (void *)0); span = icalcomponent_get_span(c); int_is("UTC #2", (int)span.start, 973296000); @@ -483,7 +483,7 @@ void test_icalcomponent_get_span() * We specify start date */ c = icalcomponent_vanew(ICAL_VEVENT_COMPONENT, - icalproperty_new_dtstart(icaltime_from_timet(tm1, 1)), (void *)0); + icalproperty_new_dtstart(icaltime_from_timet_with_zone(tm1, 1, NULL)), (void *)0); span = icalcomponent_get_span(c); if (VERBOSE) diff --git a/src/test/regression-recur.c b/src/test/regression-recur.c index 8652169c..f2a351d3 100644 --- a/src/test/regression-recur.c +++ b/src/test/regression-recur.c @@ -114,7 +114,7 @@ void test_recur_file() char msg[128]; struct icaltimetype start; - struct icaltimetype startmin = icaltime_from_timet(1, 0); + struct icaltimetype startmin = icaltime_from_timet_with_zone(1, 0, NULL); struct icaltimetype endmax = icaltime_null_time(); const char *desc_str = "malformed component"; diff --git a/src/test/regression-storage.c b/src/test/regression-storage.c index 0d356c49..f7094285 100644 --- a/src/test/regression-storage.c +++ b/src/test/regression-storage.c @@ -140,7 +140,7 @@ void test_fileset_extended(void) icalcomponent *c, *clone, *itr; icalsetiter iter; - start = icaltime_from_timet(time(0), 0); + start = icaltime_from_timet_with_zone(time(0), 0, NULL); end = start; end.hour++; @@ -305,7 +305,7 @@ void test_bdbset() return; // for now... TODO fix these broken tests.. - start = icaltime_from_timet(time(0), 0); + start = icaltime_from_timet_with_zone(time(0), 0, NULL); end = start; end.hour++; @@ -636,7 +636,7 @@ void test_dirset_extended(void) ok("Open dirset 'store'", (s != 0)); assert(s != 0); - rtime.start = icaltime_from_timet(time(0), 0); + rtime.start = icaltime_from_timet_with_zone(time(0), 0, NULL); cluster = icalfileset_new(OUTPUT_FILE); diff --git a/src/test/regression.c b/src/test/regression.c index 9c87dd86..9c399adb 100644 --- a/src/test/regression.c +++ b/src/test/regression.c @@ -215,9 +215,9 @@ void test_values() icalvalue_free(v); icalvalue_free(copy); - v = icalvalue_new_date(icaltime_from_timet(1023404802, 0)); + v = icalvalue_new_date(icaltime_from_timet_with_zone(1023404802, 0, NULL)); str_is("icalvalue_new_date()", icalvalue_as_ical_string(v), "20020606T230642"); - icalvalue_set_date(v, icaltime_from_timet(1023404802 - 3600, 0)); + icalvalue_set_date(v, icaltime_from_timet_with_zone(1023404802 - 3600, 0, NULL)); str_is("icalvalue_set_date()", icalvalue_as_ical_string(v), "20020606T220642"); copy = icalvalue_new_clone(v); @@ -709,7 +709,7 @@ void test_dirset() ok("opening 'store' dirset", s != NULL); ok("opening 'store-new' dirset", s2 != NULL); - rtime.start = icaltime_from_timet(time(0), 0); + rtime.start = icaltime_from_timet_with_zone(time(0), 0, NULL); cluster = icalfileset_new("clusterin.vcd"); @@ -867,13 +867,13 @@ void test_compare() void test_restriction() { icalcomponent *comp; - struct icaltimetype atime = icaltime_from_timet(time(0), 0); + struct icaltimetype atime = icaltime_from_timet_with_zone(time(0), 0, NULL); int valid; struct icaldatetimeperiodtype rtime; - rtime.period.start = icaltime_from_timet(time(0), 0); - rtime.period.end = icaltime_from_timet(time(0), 0); + rtime.period.start = icaltime_from_timet_with_zone(time(0), 0, NULL); + rtime.period.end = icaltime_from_timet_with_zone(time(0), 0, NULL); rtime.period.end.hour++; rtime.time = icaltime_null_time(); @@ -945,7 +945,7 @@ void test_calendar() icalset *s; icalcalendar *calendar; icalerrorenum error; - struct icaltimetype atime = icaltime_from_timet(time(0), 0); + struct icaltimetype atime = icaltime_from_timet_with_zone(time(0), 0, NULL); (void)mkdir("calendar", 0755); (void)mkdir("calendar/booked", 0755); @@ -1085,7 +1085,7 @@ void icalrecurrencetype_test() "FREQ=YEARLY;UNTIL=20060101T000000;INTERVAL=2;BYDAY=SU,WE;BYSECOND=15,30; BYMONTH=1,6,11"); struct icalrecurrencetype r = icalvalue_get_recur(v); - struct icaltimetype t = icaltime_from_timet(time(0), 0); + struct icaltimetype t = icaltime_from_timet_with_zone(time(0), 0, NULL); struct icaltimetype next; time_t tt; @@ -1488,14 +1488,6 @@ void do_test_time(const char *zone) if (VERBOSE) { printf("Orig : %s\n", ical_timet_string(tt)); } - if (VERBOSE) { - printf("\nicaltime_from_timet(tt,0) (DEPRECATED)\n"); - } - - ictt = icaltime_from_timet(tt, 0); - - str_is("icaltime_from_timet(1025127869) as UTC", ictt_as_string(ictt), - "2002-06-26 21:44:29 (floating)"); ictt = icaltime_from_timet_with_zone(tt, 0, NULL); str_is("Floating time from time_t", ictt_as_string(ictt), "2002-06-26 21:44:29 (floating)"); @@ -1988,8 +1980,8 @@ void test_overlaps() set = icalset_new(ICAL_FILE_SET, TEST_DATADIR "/overlaps.ics", &options); c = icalcomponent_vanew(ICAL_VEVENT_COMPONENT, - icalproperty_vanew_dtstart(icaltime_from_timet(tm1 - hh, 0), (void *)0), - icalproperty_vanew_dtend(icaltime_from_timet(tm2 - hh, 0), (void *)0), + icalproperty_vanew_dtstart(icaltime_from_timet_with_zone(tm1 - hh, 0, NULL), (void *)0), + icalproperty_vanew_dtend(icaltime_from_timet_with_zone(tm2 - hh, 0, NULL), (void *)0), 0); cset = icalclassify_find_overlaps(set, c); @@ -2009,8 +2001,8 @@ void test_overlaps() c = icalcomponent_vanew( ICAL_VEVENT_COMPONENT, - icalproperty_vanew_dtstart(icaltime_from_timet(tm1 - hh, 0), (void *)0), - icalproperty_vanew_dtend(icaltime_from_timet(tm2, 0), (void *)0), + icalproperty_vanew_dtstart(icaltime_from_timet_with_zone(tm1 - hh, 0, NULL), (void *)0), + icalproperty_vanew_dtend(icaltime_from_timet_with_zone(tm2, 0, NULL), (void *)0), 0); cset = icalclassify_find_overlaps(set, c); @@ -2029,8 +2021,8 @@ void test_overlaps() c = icalcomponent_vanew( ICAL_VEVENT_COMPONENT, - icalproperty_vanew_dtstart(icaltime_from_timet(tm1 + 5 * hh, 0), (void *)0), - icalproperty_vanew_dtend(icaltime_from_timet(tm2 + 5 * hh, 0), (void *)0), + icalproperty_vanew_dtstart(icaltime_from_timet_with_zone(tm1 + 5 * hh, 0, NULL), (void *)0), + icalproperty_vanew_dtend(icaltime_from_timet_with_zone(tm2 + 5 * hh, 0, NULL), (void *)0), 0); cset = icalclassify_find_overlaps(set, c); -- cgit v1.2.1