[PATCH] Make relative times default in planner.
Lubomir I. Ivanov
neolit123 at gmail.com
Sat Mar 23 07:08:09 PDT 2013
On 23 March 2013 15:10, Robert C. Helling <helling at atdotde.de> wrote:
>
>
> 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
>>
hello,
here is a quick review:
- i don't think a forwarded patch will apply using "git am" without
removing the quoted lines (>) first.
- not sure if due to the forward, but the patch has leading spaces
instead of tabs
- perhaps it will better to have this:
>> }
>> + else {
>> + if(*text == '@') {
formed as:
} else if (*text == '@') {
}
since there is only one "if" statement inside the "else" branch.
- please correct me if i'm wrong, but shouldn't there also be a
modification in starttime_focus_out_cb(), where the "is_rel" flag has
to be taken into account for this to work?
sorry if being way too thorough.
lubomir
--
More information about the subsurface
mailing list