less elapsed time: ! and ^Z

Suppress any time spent in a sub-shell or in the background when
accumulating total elapsed play time.

This won't help for leaving the game idle instead of saving and
restoring.  That's a can of worms I'd prefer to leave sealed.
This commit is contained in:
PatR
2021-08-25 14:49:58 -07:00
parent b1f3d1f864
commit 48252705b8
2 changed files with 14 additions and 2 deletions
+3 -1
View File
@@ -1,4 +1,4 @@
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.629 $ $NHDT-Date: 1629817676 2021/08/24 15:07:56 $ NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.630 $ $NHDT-Date: 1629928191 2021/08/25 21:49:51 $
General Fixes and Modified Features General Fixes and Modified Features
----------------------------------- -----------------------------------
@@ -594,6 +594,8 @@ concealed mimic could trigger sanity check warning "mimic concealed as an
object despite Prot-from-shape-changers" if hidden as "strange object" object despite Prot-from-shape-changers" if hidden as "strange object"
cancelled shape changer would become uncancelled if saved and restored (even cancelled shape changer would become uncancelled if saved and restored (even
just leaving its level and then returning) just leaving its level and then returning)
don't include time spent suspended in background (^Z) or in shell escape (!)
in the total elapsed time recorded to xlogfile
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
+11 -1
View File
@@ -1,4 +1,4 @@
/* NetHack 3.7 cmd.c $NHDT-Date: 1627408993 2021/07/27 18:03:13 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.481 $ */ /* NetHack 3.7 cmd.c $NHDT-Date: 1629928192 2021/08/25 21:49:52 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.483 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -4841,8 +4841,13 @@ dosuspend_core(void)
#ifdef SUSPEND #ifdef SUSPEND
/* Does current window system support suspend? */ /* Does current window system support suspend? */
if ((*windowprocs.win_can_suspend)()) { if ((*windowprocs.win_can_suspend)()) {
time_t now = getnow();
urealtime.realtime += timet_delta(now, urealtime.start_timing);
urealtime.start_timing = now; /* as a safeguard against panic save */
/* NB: SYSCF SHELLERS handled in port code. */ /* NB: SYSCF SHELLERS handled in port code. */
dosuspend(); dosuspend();
urealtime.start_timing = getnow(); /* resume keeping track of time */
} else } else
#endif #endif
Norep(cmdnotavail, "#suspend"); Norep(cmdnotavail, "#suspend");
@@ -4854,8 +4859,13 @@ static int
dosh_core(void) dosh_core(void)
{ {
#ifdef SHELL #ifdef SHELL
time_t now = getnow();
urealtime.realtime += timet_delta(now, urealtime.start_timing);
urealtime.start_timing = now; /* (see dosuspend_core) */
/* access restrictions, if any, are handled in port code */ /* access restrictions, if any, are handled in port code */
dosh(); dosh();
urealtime.start_timing = getnow();
#else #else
Norep(cmdnotavail, "#shell"); Norep(cmdnotavail, "#shell");
#endif #endif