summaryrefslogtreecommitdiff
path: root/src/shared/time-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-04-02 20:38:16 +0200
committerLennart Poettering <lennart@poettering.net>2013-04-03 20:12:57 +0200
commit7f602784de4fd378120e8ebfe6d830862b9cae03 (patch)
treee10d14f7b9a3154097b5f2cc2cc92ff0028101ed /src/shared/time-util.c
parent574d5f2dfc25226afc718aa5ba1a145fe5cad221 (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/time-util.c')
-rw-r--r--src/shared/time-util.c10
1 files changed, 5 insertions, 5 deletions
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;