X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2Fcorrelate%2FAudioCorrelator.java;fp=tim%2Fprune%2Fcorrelate%2FAudioCorrelator.java;h=f60d687db38c2164e37f4cea72f62cecaa9d3234;hp=432674e1547dc7765d8b507fcd2baa9e4205a761;hb=92dad5df664287acb51728e9ea599f150765d34a;hpb=81843c3d8d0771bf00d0f26034a13aa515465c78 diff --git a/tim/prune/correlate/AudioCorrelator.java b/tim/prune/correlate/AudioCorrelator.java index 432674e..f60d687 100644 --- a/tim/prune/correlate/AudioCorrelator.java +++ b/tim/prune/correlate/AudioCorrelator.java @@ -11,6 +11,7 @@ import tim.prune.App; import tim.prune.DataSubscriber; import tim.prune.I18nManager; import tim.prune.UpdateMessageBroker; +import tim.prune.config.TimezoneHelper; import tim.prune.data.AudioClip; import tim.prune.data.AudioList; import tim.prune.data.DataPoint; @@ -18,6 +19,7 @@ import tim.prune.data.MediaObject; import tim.prune.data.MediaList; import tim.prune.data.TimeDifference; import tim.prune.data.Timestamp; +import tim.prune.data.TimestampUtc; import tim.prune.undo.UndoCorrelateAudios; /** @@ -164,14 +166,19 @@ public class AudioCorrelator extends Correlator protected Timestamp getMediaTimestamp(MediaObject inMedia) { Timestamp tstamp = super.getMediaTimestamp(inMedia); + long mediaMillis = tstamp.getMilliseconds(TimezoneHelper.getSelectedTimezone()); try { AudioClip audio = (AudioClip) inMedia; int audioLength = audio.getLengthInSeconds(); // Each option is worth half the length of the audio clip, so need to divide by 2 int secsToAdd = audioLength * (_correlTimesSelector.getSelectedOption() - _fileTimesSelector.getSelectedOption()) / 2; - if (audioLength > 0 && secsToAdd != 0) { - tstamp = tstamp.createPlusOffset(secsToAdd); + if (audioLength > 0 && secsToAdd != 0) + { + mediaMillis += (secsToAdd * 1000L); + tstamp = new TimestampUtc(mediaMillis); + // Here we create a Utc timestamp but it's only temporary for the correlation + // so it will never have to react to timezone changes } } catch (ClassCastException cce) {}