xref: /freebsd-src/contrib/xz/src/xz/mytime.h (revision 3b35e7ee8de9b0260149a2b77e87a2b9c7a36244)
1 // SPDX-License-Identifier: 0BSD
2 
3 ///////////////////////////////////////////////////////////////////////////////
4 //
5 /// \file       mytime.h
6 /// \brief      Time handling functions
7 //
8 //  Author:     Lasse Collin
9 //
10 ///////////////////////////////////////////////////////////////////////////////
11 
12 
13 /// \brief      Number of milliseconds to between LZMA_SYNC_FLUSHes
14 ///
15 /// If 0, timed flushing is disabled. Otherwise if no more input is available
16 /// and not at the end of the file and at least opt_flush_timeout milliseconds
17 /// has elapsed since the start of compression or the previous flushing
18 /// (LZMA_SYNC_FLUSH or LZMA_FULL_FLUSH), set LZMA_SYNC_FLUSH to flush
19 /// the pending data.
20 extern uint64_t opt_flush_timeout;
21 
22 
23 #ifdef USE_SIGTSTP_HANDLER
24 /// \brief      Signal handler for SIGTSTP
25 extern void mytime_sigtstp_handler(int sig);
26 #endif
27 
28 
29 /// \brief      Store the time when (de)compression was started
30 ///
31 /// The start time is also stored as the time of the first flush.
32 extern void mytime_set_start_time(void);
33 
34 
35 /// \brief      Get the number of milliseconds since the operation started
36 extern uint64_t mytime_get_elapsed(void);
37 
38 
39 /// \brief      Store the time of when compressor was flushed
40 extern void mytime_set_flush_time(void);
41 
42 
43 /// \brief      Get the number of milliseconds until the next flush
44 ///
45 /// This returns -1 if no timed flushing is used.
46 ///
47 /// The return value is intended for use with poll().
48 extern int mytime_get_flush_timeout(void);
49