commit 8e2a1cf439f575505338c11b3bd339d9e8661df4
parent a1a517952fb1d281de9347b466b8f896a8c55887
Author: Florian Dold <florian.dold@gmail.com>
Date: Tue, 16 Jan 2018 15:07:18 +0100
nicer order ids
Diffstat:
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_proposal.c b/src/backend/taler-merchant-httpd_proposal.c
@@ -203,13 +203,14 @@ proposal_put (struct MHD_Connection *connection,
}
off = strftime (buf,
sizeof (buf),
- "%H.%M.%S",
+ "%Y.%j.%H.%M.%S",
tm_info);
- snprintf (buf + off,
- sizeof (buf) - off,
- "-%llX",
- (long long unsigned) GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
- UINT64_MAX));
+ buf[off++] = '-';
+ uint64_t rand = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
+ UINT64_MAX);
+ char *last = GNUNET_STRINGS_data_to_string (&rand, sizeof (uint64_t),
+ &buf[off], sizeof (buf) - off);
+ *last = '\0';
json_object_set_new (order,
"order_id",
json_string (buf));