summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-10-04 20:42:43 -0500
committerDan McGee <dan@archlinux.org>2007-10-08 20:46:55 -0500
commit60dc4b43fd4ad1c1ca2ab31f7ace7179fe3d1844 (patch)
tree4c206402369b9f939d66564d4f6c45a27861bf8f
parent6aac22187997162e9033e4b747a2421a846b9b6d (diff)
Fix backward compatibility with non-epoch builddates
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--lib/libalpm/package.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index 26157edd..0c58bba5 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -840,9 +840,14 @@ static int parse_descfile(const char *descfile, pmpkg_t *info)
} else if(!strcmp(key, "license")) {
info->licenses = alpm_list_add(info->licenses, strdup(ptr));
} else if(!strcmp(key, "builddate")) {
- info->builddate = atol(ptr);
- } else if(!strcmp(key, "installdate")) {
- info->installdate = atol(ptr);
+ char first = tolower(ptr[0]);
+ if(first > 'a' && first < 'z') {
+ struct tm tmp_tm = {0}; //initialize to null incase of failure
+ strptime(ptr, "%a %b %e %H:%M:%S %Y", &tmp_tm);
+ info->builddate = mktime(&tmp_tm);
+ } else {
+ info->builddate = atol(ptr);
+ }
} else if(!strcmp(key, "packager")) {
strncpy(info->packager, ptr, sizeof(info->packager));
} else if(!strcmp(key, "arch")) {