xref: /dragonfly/contrib/xz/src/xz/mytime.h (revision ef2687d4)
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 /// \file       mytime.h
4 /// \brief      Time handling functions
5 //
6 //  Author:     Lasse Collin
7 //
8 //  This file has been put into the public domain.
9 //  You can do whatever you want with this file.
10 //
11 ///////////////////////////////////////////////////////////////////////////////
12 
13 
14 /// \brief      Number of milliseconds to between LZMA_SYNC_FLUSHes
15 ///
16 /// If 0, timed flushing is disabled. Otherwise if no more input is available
17 /// and not at the end of the file and at least opt_flush_timeout milliseconds
18 /// has elapsed since the start of compression or the previous flushing
19 /// (LZMA_SYNC_FLUSH or LZMA_FULL_FLUSH), set LZMA_SYNC_FLUSH to flush
20 /// the pending data.
21 extern uint64_t opt_flush_timeout;
22 
23 
24 /// \brief      True when flushing is needed due to expired timeout
25 extern bool flush_needed;
26 
27 
28 /// \brief      Store the time when (de)compression was started
29 ///
30 /// The start time is also stored as the time of the first flush.
31 extern void mytime_set_start_time(void);
32 
33 
34 /// \brief      Get the number of milliseconds since the operation started
35 extern uint64_t mytime_get_elapsed(void);
36 
37 
38 /// \brief      Store the time of when compressor was flushed
39 extern void mytime_set_flush_time(void);
40 
41 
42 /// \brief      Get the number of milliseconds until the next flush
43 ///
44 /// This returns -1 if no timed flushing is used.
45 ///
46 /// The return value is inteded for use with poll().
47 extern int mytime_get_flush_timeout(void);
48