[PATCH] Make relative times default in planner.

Robert C. Helling helling at atdotde.de
Sat Mar 23 06:10:11 PDT 2013



Begin forwarded message:

> From: Robert Helling <helling at atdotde.de>
> Subject: [PATCH] Make relative times default in planner.
> Date: March 23, 2013 1:52:27 PM GMT+01:00
> 
> The old syntax with "+mm:ss" is preserved. There is a new syntax
> "@ mm:ss" to indicate (absolute) run-times.
> 
> I would assume that relative times are what people enter in a planner
> in a vast majority of cases, as planning absolute cases would only occur
> in "dinner is ready at 6pm, be back in time!" cases.
> 
> Signed-off-by: Robert Helling <helling at atdotde.de>
> ---
> planner.c |   12 ++++++++++--
> 1 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/planner.c b/planner.c
> index 012a23a..dee0805 100644
> --- a/planner.c
> +++ b/planner.c
> @@ -832,13 +832,21 @@ static int validate_time(const char *text, int *sec_p, int *rel_p)
> 	while (g_ascii_isspace(*text))
> 		text++;
> 
> -	rel = 0;
> +	rel = 1;
> 	if (*text == '+') {
> 		rel = 1;
> 		text++;
> 		while (g_ascii_isspace(*text))
> 			text++;
> 	}
> +	else {
> +		if(*text == '@') {
> +			rel = 0;
> +			text++;
> +	    		while (g_ascii_isspace(*text))
> +				text++;
> +		}
> +	}
> 
> 	min = strtol(text, &end, 10);
> 	if (text == end)
> @@ -1269,7 +1277,7 @@ void input_plan()
> 	char *explanationtext = _("<small>Add segments below.\nEach line describes part of the planned dive.\n"
> 			"An entry with depth, time and gas describes a segment that ends "
> 			"at the given depth, takes the given time (if relative, e.g. '+3:30') "
> -			"or ends at the given time (if absolute), and uses the given gas.\n"
> +			"or ends at the given time (if absolute e.g '@5:00', 'runtime'), and uses the given gas.\n"
> 			"An empty gas means 'use previous gas' (or AIR if no gas was specified).\n"
> 			"An entry that has a depth and a gas given but no time is special; it "
> 			"informs the planner that the gas specified is available for the ascent "
> -- 
> 1.7.4.4
> 

--                                                                              
.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oO 
Robert C. Helling     Elite Master Course Theoretical and Mathematical Physics  
                      Scientific Coordinator                                   
                      Ludwig Maximilians Universitaet Muenchen, Dept. Physik    
print "Just another   Phone: +49 89 2180-4523  Theresienstr. 39, rm. B339       
    stupid .sig\n";   http://www.atdotde.de 



More information about the subsurface mailing list