1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-23 15:07:03 +01:00

gpg: Use "days" in "...newer than..." diagnostics.

* g10/sig-check.c (check_signature_metadata_validity): Use days if
useful.
--

Using days instead of a high number of seconds is for the majority of
users a better measurement.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2016-01-18 11:35:26 +01:00
parent 437965e562
commit 9309bda958
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -268,10 +268,23 @@ check_signature_metadata_validity (PKT_public_key *pk, PKT_signature *sig,
if( pk->timestamp > sig->timestamp ) if( pk->timestamp > sig->timestamp )
{ {
ulong d = pk->timestamp - sig->timestamp; ulong d = pk->timestamp - sig->timestamp;
log_info if ( d < 86400 )
(ngettext("public key %s is %lu second newer than the signature\n", {
"public key %s is %lu seconds newer than the signature\n", log_info
d), keystr_from_pk (pk), d); (ngettext
("public key %s is %lu second newer than the signature\n",
"public key %s is %lu seconds newer than the signature\n",
d), keystr_from_pk (pk), d);
}
else
{
d /= 86400;
log_info
(ngettext
("public key %s is %lu day newer than the signature\n",
"public key %s is %lu days newer than the signature\n",
d), keystr_from_pk (pk), d);
}
if (!opt.ignore_time_conflict) if (!opt.ignore_time_conflict)
return GPG_ERR_TIME_CONFLICT; /* pubkey newer than signature. */ return GPG_ERR_TIME_CONFLICT; /* pubkey newer than signature. */
} }
@ -280,12 +293,24 @@ check_signature_metadata_validity (PKT_public_key *pk, PKT_signature *sig,
if( pk->timestamp > cur_time ) if( pk->timestamp > cur_time )
{ {
ulong d = pk->timestamp - cur_time; ulong d = pk->timestamp - cur_time;
log_info (ngettext("key %s was created %lu second" if (d < 86400)
" in the future (time warp or clock problem)\n", {
"key %s was created %lu seconds" log_info (ngettext("key %s was created %lu second"
" in the future (time warp or clock problem)\n", " in the future (time warp or clock problem)\n",
d), keystr_from_pk (pk), d); "key %s was created %lu seconds"
if( !opt.ignore_time_conflict ) " in the future (time warp or clock problem)\n",
d), keystr_from_pk (pk), d);
}
else
{
d /= 86400;
log_info (ngettext("key %s was created %lu day"
" in the future (time warp or clock problem)\n",
"key %s was created %lu days"
" in the future (time warp or clock problem)\n",
d), keystr_from_pk (pk), d);
}
if (!opt.ignore_time_conflict)
return GPG_ERR_TIME_CONFLICT; return GPG_ERR_TIME_CONFLICT;
} }