1
0
mirror of https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git synced 2026-10-24 00:48:53 +03:00

tools: add minutes as a new supported time unit

Make it more convenient to specify longer time periods in gpio-tools by
introducing minutes as the new time unit.

Link: https://lore.kernel.org/r/20240423100452.32958-5-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
Bartosz Golaszewski
2024-04-23 12:04:52 +02:00
parent e943b144d5
commit c34a572c53

View File

@@ -138,10 +138,12 @@ long long parse_period(const char *option)
}
if (m) {
if (*end != 's')
if (*end == '\0')
m = 60000000;
else if (*end == 's')
end++;
else
return -1;
end++;
} else {
m = 1000;
}
@@ -213,7 +215,7 @@ void print_period_help(void)
{
printf("\nPeriods:\n");
printf(" Periods are taken as milliseconds unless units are specified. e.g. 10us.\n");
printf(" Supported units are 's', 'ms', and 'us'.\n");
printf(" Supported units are 'm', 's', 'ms', and 'us' for minutes, seconds, milliseconds and microseconds respectively.\n");
}
#define TIME_BUFFER_SIZE 20