synccompare: normalize TRIGGER time ranges
60M is the same as 1H?! Ensure that each value is in the range of 0-59 resp. 0-23.
This commit is contained in:
parent
2402ceb223
commit
af43ac9d37
|
@ -663,12 +663,7 @@ string EvolutionCalendarSource::retrieveItemAsString(const ItemID &id)
|
|||
ICAL_ANY_PROPERTY);
|
||||
|
||||
while (prop) {
|
||||
icalparameter *param = icalproperty_get_first_parameter(prop,
|
||||
ICAL_TZID_PARAMETER);
|
||||
while (param) {
|
||||
icalproperty_remove_parameter_by_kind(prop, ICAL_TZID_PARAMETER);
|
||||
param = icalproperty_get_next_parameter (prop, ICAL_TZID_PARAMETER);
|
||||
}
|
||||
icalproperty_remove_parameter_by_kind(prop, ICAL_TZID_PARAMETER);
|
||||
prop = icalcomponent_get_next_property (comp,
|
||||
ICAL_ANY_PROPERTY);
|
||||
}
|
||||
|
|
|
@ -123,11 +123,25 @@ sub splitvalue {
|
|||
# normalize the DATE-TIME duration unless the VALUE isn't a duration
|
||||
sub NormalizeTrigger {
|
||||
my $value = shift;
|
||||
$value =~ s/([+-]?)P(?:(\d*)D)?T(?:(\d*)H)?(?:(\d*)M)?(?:(\d*)S)?/$1 .
|
||||
"P" . (int($2) ? ($2 . "D") : "") . "T" .
|
||||
(int($3) ? ($3 . "H") : "") .
|
||||
(int($4) ? ($4 . "M") : "") .
|
||||
(int($5) ? ($5 . "S") : "")/e;
|
||||
$value =~ /([+-]?)P(?:(\d*)D)?T(?:(\d*)H)?(?:(\d*)M)?(?:(\d*)S)?/;
|
||||
my ($sign, $days, $hours, $minutes, $seconds) = ($1, int($2), int($3), int($4), int($5));
|
||||
while ($seconds >= 60) {
|
||||
$minutes++;
|
||||
$seconds -= 60;
|
||||
}
|
||||
while ($minutes >= 60) {
|
||||
$hours++;
|
||||
$minutes -= 60;
|
||||
}
|
||||
while ($hours >= 24) {
|
||||
$days++;
|
||||
$hours -= 24;
|
||||
}
|
||||
$value = $sign;
|
||||
$value .= ($days . "D") if $days;
|
||||
$value .= ($hours . "H") if $hours;
|
||||
$value .= ($minutes . "M") if $minutes;
|
||||
$value .= ($seconds . "S") if $seconds;
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue