From 1e3b44c491556d4759fa9396b2f2b6b50dde0586 Mon Sep 17 00:00:00 2001 From: Rob Norris Date: Sat, 25 May 2013 10:01:27 +0100 Subject: [PATCH] Don't silently fail on attempting to split to a track. Annoyingly my new GPS output had a dodgy timed trackpoint, so I was wondering why the split functionality wasn't working. This now gives a chance to go to the offending point, so that hopefully if it's only one, one can delete it to fix the issue. --- src/viktrwlayer.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/viktrwlayer.c b/src/viktrwlayer.c index 4af9a92b..963c0e59 100644 --- a/src/viktrwlayer.c +++ b/src/viktrwlayer.c @@ -5284,10 +5284,19 @@ static void trw_layer_split_by_timestamp ( gpointer pass_along[6] ) while (iter) { ts = VIK_TRACKPOINT(iter->data)->timestamp; + + // Check for unordered time points - this is quite a rare occurence - unless one has reversed a track. if (ts < prev_ts) { - g_print("panic: ts < prev_ts: this should never happen!\n"); + gchar tmp_str[64]; + strftime ( tmp_str, sizeof(tmp_str), "%c", localtime(&ts) ); + if ( a_dialog_yes_or_no ( VIK_GTK_WINDOW_FROM_LAYER(vtl), + _("Can not split track due to trackpoints not ordered in time - such as at %s.\n\nGoto this trackpoint?"), + tmp_str ) ) { + goto_coord ( pass_along[1], vtl, pass_along[5], &(VIK_TRACKPOINT(iter->data)->coord) ); + } return; } + if (ts - prev_ts > thr*60) { /* flush accumulated trackpoints into new list */ newlists = g_list_append(newlists, g_list_reverse(newtps)); -- 2.39.5