aboutsummaryrefslogtreecommitdiff
path: root/src/xz
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2023-02-07 19:07:45 +0200
committerLasse Collin <lasse.collin@tukaani.org>2023-02-07 19:07:45 +0200
commit1dbe12b90cff79bb51923733ac0840747b4b4131 (patch)
tree9a1e664e4e5e95d0f4ffaad245862758b0e07a08 /src/xz
parentBuild: Adjust CMake version search regex. (diff)
downloadxz-1dbe12b90cff79bb51923733ac0840747b4b4131.tar.xz
xz: Improve the comment about start_time in mytime.c.
start_time is relative to an arbitary point in time, it's not time of day, so using it for anything else than time differences wouldn't make sense.
Diffstat (limited to 'src/xz')
-rw-r--r--src/xz/mytime.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/xz/mytime.c b/src/xz/mytime.c
index 917eff0f..9eff566f 100644
--- a/src/xz/mytime.c
+++ b/src/xz/mytime.c
@@ -20,11 +20,16 @@
uint64_t opt_flush_timeout = 0;
-// The start_time variable will not represent the actual start time
-// if mytime_sigtstp_handler() executes. The signal handler measures
-// the amount of time spent stopped and adds it to start_time.
-// So, care must be taken in the future if the actual start time needs
-// to be displayed for any reason.
+// start_time holds the time when the (de)compression was started.
+// It's from mytime_now() and thus only useful for calculating relative
+// time differences (elapsed time). start_time is initialized by calling
+// mytime_set_start_time() and modified by mytime_sigtstp_handler().
+//
+// When mytime_sigtstp_handler() is used, start_time is made volatile.
+// I'm not sure if that is really required since access to it is guarded
+// by signals_block()/signals_unblock() since accessing an uint64_t isn't
+// atomic on all systems. But since the variable isn't accessed very
+// frequently making it volatile doesn't hurt.
#ifdef USE_SIGTSTP_HANDLER
static volatile uint64_t start_time;
#else