diff --git a/ui/dr-ui/src/merge.rs b/ui/dr-ui/src/merge.rs index 0dd713a..370d5a8 100644 --- a/ui/dr-ui/src/merge.rs +++ b/ui/dr-ui/src/merge.rs @@ -518,7 +518,16 @@ fn run_inner( let black = first.raw.black_level[0]; let white_level = u32::from(first.raw.white_level.saturating_sub(black)).max(1); let profile = dng_profile(first, white_level); - let (_, carried) = crate::export::header_for_file(&first.meta); + let (_, mut carried) = crate::export::header_for_file(&first.meta); + // The composite is dated at the middle of its sweep — the mean of the + // frames' capture times — so it sorts among the frames it was made + // from, not at the first of them and not at the moment of the merge. + // The zone is the first frame's; a sweep does not cross one. + let stamps: Vec = frames.iter().filter_map(|f| f.meta.captured_at).collect(); + if !stamps.is_empty() { + let sum: i128 = stamps.iter().map(|&t| t as i128).sum(); + carried.captured_at = Some((sum / stamps.len() as i128) as i64); + } let output = MergeOutput { projection,