// check time constraints
Long duration = activity.withConstraints().withTime().getDuration();
if (duration != null) {
String start = activity.withStatus().getStart();
String end = activity.withStatus().getEnd();
if (start != null && end != null) {
DateTime startTime = new DateTime(start);
DateTime endTime = new DateTime(end);
Interval interval = new Interval(startTime, endTime);
if (interval.toDurationMillis() != duration) {