diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-04-02 20:38:16 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-04-03 20:12:57 +0200 |
commit | 7f602784de4fd378120e8ebfe6d830862b9cae03 (patch) | |
tree | e10d14f7b9a3154097b5f2cc2cc92ff0028101ed /src/shared | |
parent | 574d5f2dfc25226afc718aa5ba1a145fe5cad221 (diff) |
util: rename parse_usec() to parse_sec() sinds the default unit is seconds
Internally we store all time values in usec_t, however parse_usec()
actually was used mostly to parse values in seconds (unless explicit
units were specified to define a different unit). Hence, be clear about
this and name the function about what we pass into it, not what we get
out of it.
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/conf-parser.c | 4 | ||||
-rw-r--r-- | src/shared/conf-parser.h | 2 | ||||
-rw-r--r-- | src/shared/time-util.c | 10 | ||||
-rw-r--r-- | src/shared/time-util.h | 2 |
4 files changed, 9 insertions, 9 deletions
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c index c2cf5a6a19..a87df382ea 100644 --- a/src/shared/conf-parser.c +++ b/src/shared/conf-parser.c @@ -792,7 +792,7 @@ int config_parse_path_strv( return 0; } -int config_parse_usec( +int config_parse_sec( const char *filename, unsigned line, const char *section, @@ -809,7 +809,7 @@ int config_parse_usec( assert(rvalue); assert(data); - if (parse_usec(rvalue, usec) < 0) { + if (parse_sec(rvalue, usec) < 0) { log_error("[%s:%u] Failed to parse time value, ignoring: %s", filename, line, rvalue); return 0; } diff --git a/src/shared/conf-parser.h b/src/shared/conf-parser.h index 9096c605e2..88194f6771 100644 --- a/src/shared/conf-parser.h +++ b/src/shared/conf-parser.h @@ -101,7 +101,7 @@ int config_parse_string(const char *filename, unsigned line, const char *section int config_parse_path(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); int config_parse_strv(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); int config_parse_path_strv(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); -int config_parse_usec(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); +int config_parse_sec(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); int config_parse_nsec(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); int config_parse_mode(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); int config_parse_facility(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); diff --git a/src/shared/time-util.c b/src/shared/time-util.c index 0c6deb66f4..e27aaf6c6a 100644 --- a/src/shared/time-util.c +++ b/src/shared/time-util.c @@ -256,7 +256,7 @@ char *format_timespan(char *buf, size_t l, usec_t t) { return p; } - /* The result of this function can be parsed with parse_usec */ + /* The result of this function can be parsed with parse_sec */ for (i = 0; i < ELEMENTSOF(table); i++) { int k; @@ -382,14 +382,14 @@ int parse_timestamp(const char *t, usec_t *usec) { } else if (t[0] == '+') { - r = parse_usec(t+1, &plus); + r = parse_sec(t+1, &plus); if (r < 0) return r; goto finish; } else if (t[0] == '-') { - r = parse_usec(t+1, &minus); + r = parse_sec(t+1, &minus); if (r < 0) return r; @@ -402,7 +402,7 @@ int parse_timestamp(const char *t, usec_t *usec) { if (!z) return -ENOMEM; - r = parse_usec(z, &minus); + r = parse_sec(z, &minus); if (r < 0) return r; @@ -497,7 +497,7 @@ finish: return 0; } -int parse_usec(const char *t, usec_t *usec) { +int parse_sec(const char *t, usec_t *usec) { static const struct { const char *suffix; usec_t usec; diff --git a/src/shared/time-util.h b/src/shared/time-util.h index ec263c1a19..2e3b0f5744 100644 --- a/src/shared/time-util.h +++ b/src/shared/time-util.h @@ -80,5 +80,5 @@ void dual_timestamp_deserialize(const char *value, dual_timestamp *t); int parse_timestamp(const char *t, usec_t *usec); -int parse_usec(const char *t, usec_t *usec); +int parse_sec(const char *t, usec_t *usec); int parse_nsec(const char *t, nsec_t *nsec); |