Print and typecast time_t correctly
The recommended C99 way to print the value of a time_t is to cast it to uintmax_t or intmax_t. Do this to ensure compatability with all platforms. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
8b1fb61df2
commit
bd15c23e16
1 changed files with 3 additions and 4 deletions
|
@ -27,13 +27,12 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdint.h> /* uintmax_t */
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#ifdef CYGWIN
|
|
||||||
#include <limits.h> /* PATH_MAX */
|
#include <limits.h> /* PATH_MAX */
|
||||||
#endif
|
|
||||||
|
|
||||||
/* libalpm */
|
/* libalpm */
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
|
@ -589,11 +588,11 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
|
||||||
}
|
}
|
||||||
if(info->builddate) {
|
if(info->builddate) {
|
||||||
fprintf(fp, "%%BUILDDATE%%\n"
|
fprintf(fp, "%%BUILDDATE%%\n"
|
||||||
"%lu\n\n", info->builddate);
|
"%ju\n\n", (uintmax_t)info->builddate);
|
||||||
}
|
}
|
||||||
if(info->installdate) {
|
if(info->installdate) {
|
||||||
fprintf(fp, "%%INSTALLDATE%%\n"
|
fprintf(fp, "%%INSTALLDATE%%\n"
|
||||||
"%lu\n\n", info->installdate);
|
"%ju\n\n", (uintmax_t)info->installdate);
|
||||||
}
|
}
|
||||||
if(info->packager[0]) {
|
if(info->packager[0]) {
|
||||||
fprintf(fp, "%%PACKAGER%%\n"
|
fprintf(fp, "%%PACKAGER%%\n"
|
||||||
|
|
Loading…
Add table
Reference in a new issue