aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/gettime.c2
-rw-r--r--doc/gpg.texi3
-rw-r--r--g10/gpg.c14
3 files changed, 16 insertions, 3 deletions
diff --git a/common/gettime.c b/common/gettime.c
index e5da4fb1a..3e1ee5569 100644
--- a/common/gettime.c
+++ b/common/gettime.c
@@ -133,7 +133,7 @@ gnupg_set_time (time_t newtime, int freeze)
else if (freeze)
{
timemode = FROZEN;
- timewarp = current;
+ timewarp = newtime == (time_t)-1 ? current : newtime;
}
else if (newtime > current)
{
diff --git a/doc/gpg.texi b/doc/gpg.texi
index 4ea2cd21e..044ba3761 100644
--- a/doc/gpg.texi
+++ b/doc/gpg.texi
@@ -2748,6 +2748,9 @@ forth to @var{epoch} which is the number of seconds elapsed since the year
1970. Alternatively @var{epoch} may be given as a full ISO time string
(e.g. "20070924T154812").
+If you suffix @var{epoch} with an exclamation mark (!), the system time
+will appear to be frozen at the specified time.
+
@item --enable-progress-filter
@opindex enable-progress-filter
Enable certain PROGRESS status outputs. This option allows frontends
diff --git a/g10/gpg.c b/g10/gpg.c
index 8c5b50589..f9039ae09 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -3493,10 +3493,20 @@ main (int argc, char **argv)
case oFakedSystemTime:
{
- time_t faked_time = isotime2epoch (pargs.r.ret_str);
+ size_t len = strlen (pargs.r.ret_str);
+ int freeze = 0;
+ time_t faked_time;
+
+ if (len > 0 && pargs.r.ret_str[len-1] == '!')
+ {
+ freeze = 1;
+ pargs.r.ret_str[len-1] = '\0';
+ }
+
+ faked_time = isotime2epoch (pargs.r.ret_str);
if (faked_time == (time_t)(-1))
faked_time = (time_t)strtoul (pargs.r.ret_str, NULL, 10);
- gnupg_set_time (faked_time, 0);
+ gnupg_set_time (faked_time, freeze);
}
break;