From e6673544b2afc9e463cdbf4e7d0bb0b5d7b6b80d Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 8 Nov 2007 23:18:07 -0600 Subject: Fix some issues with localized dates/epoch usage Commit 47622eef4dd8fd86a0aa0e3ebdb7b33f7c9d6804 introduced localized times in the metadata by way of storing the UNIX epoch value instead of a hard coded date string. However, it missed a few things: * If we weren't in the C/POSIX/en_US locale, the date parsing would fail as it tried to use the abbreviations of the locale being used. Fix this by switching the LC_TIME value before we parse a date. * We used ctime to print the date value, which is always the C locale string. Instead, use strftime to print a localized date string. Signed-off-by: Dan McGee --- lib/libalpm/package.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/libalpm/package.c') diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 5103a382..1e59938f 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -852,8 +852,10 @@ static int parse_descfile(const char *descfile, pmpkg_t *info) char first = tolower(ptr[0]); if(first > 'a' && first < 'z') { struct tm tmp_tm = {0}; //initialize to null incase of failure + setlocale(LC_TIME, "C"); strptime(ptr, "%a %b %e %H:%M:%S %Y", &tmp_tm); info->builddate = mktime(&tmp_tm); + setlocale(LC_TIME, ""); } else { info->builddate = atol(ptr); } -- cgit v1.2.3-24-g4f1b