From 5f3629bea0d4beb79c6092086b46f3d73643c76d Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 7 Sep 2011 10:21:47 -0500 Subject: 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 --- lib/libalpm/util.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/libalpm/util.c') 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; } /** -- cgit v1.2.3-24-g4f1b