summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/util.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-09-07 17:21:47 +0200
committerDan McGee <dan@archlinux.org>2011-10-12 21:01:25 +0200
commit5f3629bea0d4beb79c6092086b46f3d73643c76d (patch)
tree77fec7e0aa39d6bca0309d0043a68d7a9698d237 /lib/libalpm/util.c
parent759f435fb91a3abf64a422b53f939a774332cd8a (diff)
downloadpacman-5f3629bea0d4beb79c6092086b46f3d73643c76d.tar.gz
pacman-5f3629bea0d4beb79c6092086b46f3d73643c76d.tar.xz
Introduce alpm_time_t type
This will always be a 64-bit signed integer rather than the variable length time_t type. Dates beyond 2038 should be fully supported in the library; the frontend still lags behind because 32-bit platforms provide no localtime64() or equivalent function to convert from an epoch value to a broken down time structure. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/util.c')
-rw-r--r--lib/libalpm/util.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 243978cd..d723aee2 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -1107,7 +1107,7 @@ off_t _alpm_strtoofft(const char *line)
return (off_t)result;
}
-time_t _alpm_parsedate(const char *line)
+alpm_time_t _alpm_parsedate(const char *line)
{
char *end;
long long result;
@@ -1120,24 +1120,24 @@ time_t _alpm_parsedate(const char *line)
setlocale(LC_TIME, "C");
strptime(line, "%a %b %e %H:%M:%S %Y", &tmp_tm);
setlocale(LC_TIME, "");
- return mktime(&tmp_tm);
+ return (alpm_time_t)mktime(&tmp_tm);
}
result = strtoll(line, &end, 10);
if (result == 0 && end == line) {
/* line was not a number */
errno = EINVAL;
- return (time_t)0;
+ return 0;
} else if (errno == ERANGE) {
/* line does not fit in long long */
- return (time_t)0;
+ return 0;
} else if (*end) {
/* line began with a number but has junk left over at the end */
errno = EINVAL;
- return (time_t)0;
+ return 0;
}
- return (time_t)result;
+ return (alpm_time_t)result;
}
/**