summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/parse.c2
-rw-r--r--src/xtime.c20
-rw-r--r--src/xtime.h2
3 files changed, 12 insertions, 12 deletions
diff --git a/src/parse.c b/src/parse.c
index 1be7cb7..ef52cbe 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -1898,7 +1898,7 @@ static enum bfs_stat_field parse_newerxy_field(char c) {
/** Parse an explicit reference timestamp for -newerXt and -*since. */
static int parse_reftime(const struct parser_state *state, struct bfs_expr *expr) {
- if (parse_timestamp(expr->argv[1], &expr->reftime) == 0) {
+ if (xgetdate(expr->argv[1], &expr->reftime) == 0) {
return 0;
} else if (errno != EINVAL) {
parse_expr_error(state, expr, "%m.\n");
diff --git a/src/xtime.c b/src/xtime.c
index 8ca963b..bcd4e66 100644
--- a/src/xtime.c
+++ b/src/xtime.c
@@ -184,7 +184,7 @@ overflow:
}
/** Parse some digits from a timestamp. */
-static int parse_timestamp_part(const char **str, size_t n, int *result) {
+static int xgetpart(const char **str, size_t n, int *result) {
char buf[n + 1];
for (size_t i = 0; i < n; ++i, ++*str) {
char c = **str;
@@ -199,7 +199,7 @@ static int parse_timestamp_part(const char **str, size_t n, int *result) {
return 0;
}
-int parse_timestamp(const char *str, struct timespec *result) {
+int xgetdate(const char *str, struct timespec *result) {
struct tm tm = {
.tm_isdst = -1,
};
@@ -210,7 +210,7 @@ int parse_timestamp(const char *str, struct timespec *result) {
bool local = true;
// YYYY
- if (parse_timestamp_part(&str, 4, &tm.tm_year) != 0) {
+ if (xgetpart(&str, 4, &tm.tm_year) != 0) {
goto invalid;
}
tm.tm_year -= 1900;
@@ -219,7 +219,7 @@ int parse_timestamp(const char *str, struct timespec *result) {
if (*str == '-') {
++str;
}
- if (parse_timestamp_part(&str, 2, &tm.tm_mon) != 0) {
+ if (xgetpart(&str, 2, &tm.tm_mon) != 0) {
goto invalid;
}
tm.tm_mon -= 1;
@@ -228,7 +228,7 @@ int parse_timestamp(const char *str, struct timespec *result) {
if (*str == '-') {
++str;
}
- if (parse_timestamp_part(&str, 2, &tm.tm_mday) != 0) {
+ if (xgetpart(&str, 2, &tm.tm_mday) != 0) {
goto invalid;
}
@@ -239,7 +239,7 @@ int parse_timestamp(const char *str, struct timespec *result) {
}
// hh
- if (parse_timestamp_part(&str, 2, &tm.tm_hour) != 0) {
+ if (xgetpart(&str, 2, &tm.tm_hour) != 0) {
goto invalid;
}
@@ -249,7 +249,7 @@ int parse_timestamp(const char *str, struct timespec *result) {
} else if (*str == ':') {
++str;
}
- if (parse_timestamp_part(&str, 2, &tm.tm_min) != 0) {
+ if (xgetpart(&str, 2, &tm.tm_min) != 0) {
goto invalid;
}
@@ -259,7 +259,7 @@ int parse_timestamp(const char *str, struct timespec *result) {
} else if (*str == ':') {
++str;
}
- if (parse_timestamp_part(&str, 2, &tm.tm_sec) != 0) {
+ if (xgetpart(&str, 2, &tm.tm_sec) != 0) {
goto invalid;
}
@@ -274,7 +274,7 @@ int parse_timestamp(const char *str, struct timespec *result) {
++str;
// hh
- if (parse_timestamp_part(&str, 2, &tz_hour) != 0) {
+ if (xgetpart(&str, 2, &tz_hour) != 0) {
goto invalid;
}
@@ -284,7 +284,7 @@ int parse_timestamp(const char *str, struct timespec *result) {
} else if (*str == ':') {
++str;
}
- if (parse_timestamp_part(&str, 2, &tz_min) != 0) {
+ if (xgetpart(&str, 2, &tz_min) != 0) {
goto invalid;
}
} else {
diff --git a/src/xtime.h b/src/xtime.h
index ceff48f..cca1428 100644
--- a/src/xtime.h
+++ b/src/xtime.h
@@ -81,6 +81,6 @@ int xtimegm(struct tm *tm, time_t *timep);
* @return
* 0 on success, -1 on failure.
*/
-int parse_timestamp(const char *str, struct timespec *result);
+int xgetdate(const char *str, struct timespec *result);
#endif // BFS_XTIME_H