summaryrefslogtreecommitdiff
path: root/builtin/rev-parse.c
diff options
context:
space:
mode:
authorLibravatar Johannes Schindelin <johannes.schindelin@gmx.de>2017-04-21 12:45:48 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-04-23 20:19:15 -0700
commitcb71f8bdb5a105cd5b66142b887989d9addc82d0 (patch)
treee5d673bfdd396ebfc6fb0957a86dd532c25e995b /builtin/rev-parse.c
parentparse_timestamp(): specify explicitly where we parse timestamps (diff)
downloadtgif-cb71f8bdb5a105cd5b66142b887989d9addc82d0.tar.xz
PRItime: introduce a new "printf format" for timestamps
Currently, Git's source code treats all timestamps as if they were unsigned longs. Therefore, it is okay to write "%lu" when printing them. There is a substantial problem with that, though: at least on Windows, time_t is *larger* than unsigned long, and hence we will want to switch away from the ill-specified `unsigned long` data type. So let's introduce the pseudo format "PRItime" (currently simply being defined to "lu") to make it easier to change the data type used for timestamps. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/rev-parse.c')
-rw-r--r--builtin/rev-parse.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index 0513330910..b450900243 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -218,7 +218,7 @@ static void show_datestring(const char *flag, const char *datestr)
/* date handling requires both flags and revs */
if ((filter & (DO_FLAGS | DO_REVS)) != (DO_FLAGS | DO_REVS))
return;
- buffer = xstrfmt("%s%lu", flag, approxidate(datestr));
+ buffer = xstrfmt("%s%"PRItime, flag, approxidate(datestr));
show(buffer);
free(buffer);
}