From 4bc6ed56aa48784c8caf56c3a6fb1a3c972d221c Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Fri, 7 Jan 2011 20:35:43 -0600 Subject: Refactor old date parsing into single method We've managed to duplicate this four times at this point, so make it a method in util.c instead. Signed-off-by: Dan McGee --- lib/libalpm/be_sync.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'lib/libalpm/be_sync.c') diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c index c7d8e045..81f3e46e 100644 --- a/lib/libalpm/be_sync.c +++ b/lib/libalpm/be_sync.c @@ -21,7 +21,6 @@ #include "config.h" #include -#include #include #include @@ -313,17 +312,7 @@ static int sync_db_read(pmdb_t *db, struct archive *archive, struct archive_entr READ_AND_STORE(pkg->arch); } else if(strcmp(line, "%BUILDDATE%") == 0) { READ_NEXT(line); - char first = tolower((unsigned char)line[0]); - if(first > 'a' && first < 'z') { - /* initialize to null in case of failure */ - struct tm tmp_tm = {0}; - setlocale(LC_TIME, "C"); - strptime(line, "%a %b %e %H:%M:%S %Y", &tmp_tm); - pkg->builddate = mktime(&tmp_tm); - setlocale(LC_TIME, ""); - } else { - pkg->builddate = atol(line); - } + pkg->builddate = _alpm_parsedate(line); } else if(strcmp(line, "%PACKAGER%") == 0) { READ_AND_STORE(pkg->packager); } else if(strcmp(line, "%CSIZE%") == 0) { -- cgit v1.2.3