Mercurial > octave
annotate liboctave/system/oct-time.h @ 32090:7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
* liboctave/system/oct-time.h, oct-time.cc (octave::sys::file_time): New class
to handle an efficient native file time type per platform.
* libinterp/corefcn/load-path.h (load_path::dir_info::dir_mtime,
load_path::dir_info::dir_time_last_checked): Change type to new class.
* libinterp/corefcn/load-path.cc (subdirs_modified, load_path::dir_info::update,
load_path::dir_info::initialize): Avoid using file_stat on Windows.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sat, 13 May 2023 13:33:57 +0200 |
parents | 1daf8bfceac3 |
children | ae4e19c0a2b1 2e484f9f1f18 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
31706
597f3ee61a48
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
31607
diff
changeset
|
3 // Copyright (C) 1999-2023 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
3253 | 25 |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
26 #if ! defined (octave_oct_time_h) |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17769
diff
changeset
|
27 #define octave_oct_time_h 1 |
3253 | 28 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21218
diff
changeset
|
29 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21218
diff
changeset
|
30 |
23676
e719f04a5707
new output stream operator for octave::sys::time objects
John W. Eaton <jwe@octave.org>
parents:
23615
diff
changeset
|
31 #include <iosfwd> |
3253 | 32 #include <string> |
33 | |
32090
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
34 #if defined (OCTAVE_USE_WINDOWS_API) |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
35 // Some Windows headers must be included in a certain order. |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
36 // Don't include "windows.h" here to avoid potential issues due to that. |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
37 // Instead just define the one type we need for the interface of one function. |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
38 struct OCTAVE_WIN_FILETIME |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
39 { |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
40 uint32_t dwLowDateTime; |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
41 uint32_t dwHighDateTime; |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
42 }; |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
43 #endif |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
44 |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
45 |
22864
d744b1ed4851
avoid conversion warnings in time -> double functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
46 static inline double |
30826
243b51ec9ff0
Remove `time_t` from API (bug #61821).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30564
diff
changeset
|
47 as_double (OCTAVE_TIME_T sec, long usec) |
22864
d744b1ed4851
avoid conversion warnings in time -> double functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
48 { |
d744b1ed4851
avoid conversion warnings in time -> double functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
49 // Unix time will be exactly representable as a double for more than |
d744b1ed4851
avoid conversion warnings in time -> double functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
50 // 100 million years, so no worry there, and microseconds has a |
d744b1ed4851
avoid conversion warnings in time -> double functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
51 // range of 0-1e6, so we are safe there as well. |
d744b1ed4851
avoid conversion warnings in time -> double functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
52 |
d744b1ed4851
avoid conversion warnings in time -> double functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
53 return (static_cast<double> (sec) + static_cast<double> (usec) / 1.0e6); |
d744b1ed4851
avoid conversion warnings in time -> double functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
54 } |
d744b1ed4851
avoid conversion warnings in time -> double functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
55 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30826
diff
changeset
|
56 OCTAVE_BEGIN_NAMESPACE(octave) |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30826
diff
changeset
|
57 |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30826
diff
changeset
|
58 OCTAVE_BEGIN_NAMESPACE(sys) |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30826
diff
changeset
|
59 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
60 class base_tm; |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
61 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
62 class |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
63 time |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
64 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
65 public: |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
66 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
67 time () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
68 : m_ot_unix_time (0), m_ot_usec (0) { stamp (); } |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
69 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
70 time (OCTAVE_TIME_T t) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
71 : m_ot_unix_time (t), m_ot_usec (0) { } |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
72 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
73 time (OCTAVE_TIME_T t, long us) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
74 : m_ot_unix_time (t), m_ot_usec () |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
75 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
76 long rem, extra; |
3253 | 77 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
78 if (us >= 0) |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
79 { |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
80 rem = us % 1000000; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
81 extra = (us - rem) / 1000000; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
82 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
83 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
84 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
85 us = -us; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
86 rem = us % 1000000; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
87 extra = - (1 + (us - rem) / 1000000); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
88 rem = 1000000 - us % 1000000; |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
89 } |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
90 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
91 m_ot_usec = rem; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
92 m_ot_unix_time += extra; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
93 } |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
94 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
95 OCTAVE_API time (double d); |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
96 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
97 OCTAVE_API time (const base_tm& tm); |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
98 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
99 time (const time& ot) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
100 : m_ot_unix_time (ot.m_ot_unix_time), m_ot_usec (ot.m_ot_usec) { } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
101 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
102 time& operator = (const time& ot) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
103 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
104 if (this != &ot) |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
105 { |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
106 m_ot_unix_time = ot.m_ot_unix_time; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
107 m_ot_usec = ot.m_ot_usec; |
22864
d744b1ed4851
avoid conversion warnings in time -> double functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
108 } |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
109 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
110 return *this; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
111 } |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
112 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
113 ~time () = default; |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
114 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
115 OCTAVE_API void stamp (); |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
116 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
117 double double_value () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
118 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
119 return as_double (m_ot_unix_time, m_ot_usec); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
120 } |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
121 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
122 OCTAVE_TIME_T unix_time () const { return m_ot_unix_time; } |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
123 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
124 long usec () const { return m_ot_usec; } |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
125 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
126 OCTAVE_API std::string ctime () const; |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
127 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
128 friend OCTAVE_API std::ostream& operator << (std::ostream& os, const time& ot); |
9748
d6b2b708b6b0
load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents:
7231
diff
changeset
|
129 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
130 private: |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
131 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
132 // Seconds since the epoch. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
133 OCTAVE_TIME_T m_ot_unix_time; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
134 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
135 // Additional microseconds. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
136 long m_ot_usec; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
137 }; |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
138 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
139 inline bool |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
140 operator == (const time& t1, const time& t2) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
141 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
142 return (t1.unix_time () == t2.unix_time () && t1.usec () == t2.usec ()); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
143 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
144 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
145 inline bool |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
146 operator != (const time& t1, const time& t2) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
147 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
148 return ! (t1 == t2); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
149 } |
9748
d6b2b708b6b0
load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents:
7231
diff
changeset
|
150 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
151 inline bool |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
152 operator < (const time& t1, const time& t2) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
153 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
154 if (t1.unix_time () < t2.unix_time ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
155 return true; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
156 else if (t1.unix_time () > t2.unix_time ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
157 return false; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
158 else if (t1.usec () < t2.usec ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
159 return true; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
160 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
161 return false; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
162 } |
3253 | 163 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
164 inline bool |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
165 operator <= (const time& t1, const time& t2) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
166 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
167 return (t1 < t2 || t1 == t2); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
168 } |
3253 | 169 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
170 inline bool |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
171 operator > (const time& t1, const time& t2) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
172 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
173 if (t1.unix_time () > t2.unix_time ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
174 return true; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
175 else if (t1.unix_time () < t2.unix_time ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
176 return false; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
177 else if (t1.usec () > t2.usec ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
178 return true; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
179 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
180 return false; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
181 } |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
182 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
183 inline bool |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
184 operator >= (const time& t1, const time& t2) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
185 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
186 return (t1 > t2 || t1 == t2); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
187 } |
3253 | 188 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
189 inline time |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
190 operator + (const time& t1, const time& t2) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
191 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
192 return time (t1.unix_time () + t2.unix_time (), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
193 t1.usec () + t2.usec ()); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
194 } |
3253 | 195 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
196 class |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
197 base_tm |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
198 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
199 public: |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
200 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
201 base_tm () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
202 : m_usec (0), m_sec (0), m_min (0), m_hour (0), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
203 m_mday (0), m_mon (0), m_year (0), m_wday (0), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
204 m_yday (0), m_isdst (0), m_gmtoff (0), m_zone ("unknown") |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
205 { } |
3253 | 206 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
207 base_tm (const base_tm& tm) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
208 : m_usec (tm.m_usec), m_sec (tm.m_sec), m_min (tm.m_min), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
209 m_hour (tm.m_hour), m_mday (tm.m_mday), m_mon (tm.m_mon), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
210 m_year (tm.m_year), m_wday (tm.m_wday), m_yday (tm.m_yday), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
211 m_isdst (tm.m_isdst), m_gmtoff (tm.m_gmtoff), m_zone (tm.m_zone) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
212 { } |
3253 | 213 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
214 base_tm& operator = (const base_tm& tm) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
215 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
216 if (this != &tm) |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
217 { |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
218 m_usec = tm.m_usec; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
219 m_sec = tm.m_sec; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
220 m_min = tm.m_min; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
221 m_hour = tm.m_hour; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
222 m_mday = tm.m_mday; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
223 m_mon = tm.m_mon; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
224 m_year = tm.m_year; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
225 m_wday = tm.m_wday; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
226 m_yday = tm.m_yday; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
227 m_isdst = tm.m_isdst; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
228 m_gmtoff = tm.m_gmtoff; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
229 m_zone = tm.m_zone; |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
230 } |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
231 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
232 return *this; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
233 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
234 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
235 virtual ~base_tm () = default; |
3253 | 236 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
237 int usec () const { return m_usec; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
238 int sec () const { return m_sec; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
239 int min () const { return m_min; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
240 int hour () const { return m_hour; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
241 int mday () const { return m_mday; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
242 int mon () const { return m_mon; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
243 int year () const { return m_year; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
244 int wday () const { return m_wday; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
245 int yday () const { return m_yday; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
246 int isdst () const { return m_isdst; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
247 long gmtoff () const { return m_gmtoff; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
248 std::string zone () const { return m_zone; } |
3253 | 249 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
250 OCTAVE_API base_tm& usec (int v); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
251 OCTAVE_API base_tm& sec (int v); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
252 OCTAVE_API base_tm& min (int v); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
253 OCTAVE_API base_tm& hour (int v); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
254 OCTAVE_API base_tm& mday (int v); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
255 OCTAVE_API base_tm& mon (int v); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
256 OCTAVE_API base_tm& year (int v); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
257 OCTAVE_API base_tm& wday (int v); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
258 OCTAVE_API base_tm& yday (int v); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
259 OCTAVE_API base_tm& isdst (int v); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
260 OCTAVE_API base_tm& gmtoff (long v); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
261 OCTAVE_API base_tm& zone (const std::string& s); |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
262 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
263 OCTAVE_API std::string strftime (const std::string& fmt) const; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
264 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
265 std::string asctime () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
266 { return strftime ("%a %b %d %H:%M:%S %Y\n"); } |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
267 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
268 protected: |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
269 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
270 // Microseconds after the second (0, 999999). |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
271 int m_usec; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
272 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
273 // Seconds after the minute (0, 61). |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
274 int m_sec; |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
275 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
276 // Minutes after the hour (0, 59). |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
277 int m_min; |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
278 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
279 // Hours since midnight (0, 23). |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
280 int m_hour; |
3255 | 281 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
282 // Day of the month (1, 31). |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
283 int m_mday; |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
284 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
285 // Months since January (0, 11). |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
286 int m_mon; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
287 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
288 // Years since 1900. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
289 int m_year; |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
290 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
291 // Days since Sunday (0, 6). |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
292 int m_wday; |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
293 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
294 // Days since January 1 (0, 365). |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
295 int m_yday; |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
296 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
297 // Daylight saving time flag. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
298 int m_isdst; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
299 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
300 // Time zone. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
301 long m_gmtoff; |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
302 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
303 // Time zone. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
304 std::string m_zone; |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
305 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
306 OCTAVE_API void init (void *p); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
307 }; |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
308 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
309 class |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
310 localtime : public base_tm |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
311 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
312 public: |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
313 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
314 localtime () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
315 : base_tm () { init (time ()); } |
3255 | 316 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
317 localtime (const time& ot) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
318 : base_tm () { init (ot); } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
319 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
320 localtime (const localtime& t) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
321 : base_tm (t) { } |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
322 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
323 localtime& operator = (const localtime& t) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
324 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
325 base_tm::operator = (t); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
326 return *this; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
327 } |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
328 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
329 ~localtime () = default; |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
330 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
331 private: |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
332 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
333 OCTAVE_API void init (const time& ot); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
334 }; |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
335 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
336 class |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
337 gmtime : public base_tm |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
338 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
339 public: |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
340 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
341 gmtime () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
342 : base_tm () { init (time ()); } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
343 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
344 gmtime (const time& ot) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
345 : base_tm () { init (ot); } |
3255 | 346 |
31855
1daf8bfceac3
default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents:
31771
diff
changeset
|
347 OCTAVE_DEFAULT_COPY_MOVE_DELETE (gmtime) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
348 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
349 private: |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
350 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
351 OCTAVE_API void init (const time& ot); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
352 }; |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
353 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
354 class |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
355 strptime : public base_tm |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
356 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
357 public: |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
358 |
31855
1daf8bfceac3
default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents:
31771
diff
changeset
|
359 strptime () = delete; |
1daf8bfceac3
default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents:
31771
diff
changeset
|
360 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
361 strptime (const std::string& str, const std::string& fmt) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
362 : base_tm (), m_nchars (0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
363 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
364 init (str, fmt); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
365 } |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
366 |
31855
1daf8bfceac3
default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents:
31771
diff
changeset
|
367 OCTAVE_DEFAULT_COPY_MOVE_DELETE (strptime) |
3255 | 368 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
369 int characters_converted () const { return m_nchars; } |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
370 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
371 private: |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
372 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
373 int m_nchars; |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
374 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
375 OCTAVE_API void init (const std::string& str, const std::string& fmt); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
376 }; |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
377 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
378 class |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
379 cpu_time |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
380 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
381 public: |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
382 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
383 friend class resource_usage; |
3255 | 384 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
385 cpu_time () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
386 : m_usr_sec (0), m_sys_sec (0), m_usr_usec (0), m_sys_usec (0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
387 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
388 stamp (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
389 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
390 |
31855
1daf8bfceac3
default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents:
31771
diff
changeset
|
391 OCTAVE_DEFAULT_COPY_MOVE_DELETE (cpu_time) |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
392 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
393 OCTAVE_API void stamp (); |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
394 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
395 double user () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
396 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
397 return as_double (m_usr_sec, m_usr_usec); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
398 } |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
399 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
400 double system () const |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
401 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
402 return as_double (m_sys_sec, m_sys_usec); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
403 } |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
404 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
405 OCTAVE_TIME_T user_sec () const { return m_usr_sec; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
406 long user_usec () const { return m_usr_usec; } |
21930
f0c5dd1ea2b9
hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents:
21752
diff
changeset
|
407 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
408 OCTAVE_TIME_T system_sec () const { return m_sys_sec; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
409 long system_usec () const { return m_sys_usec; } |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
410 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
411 private: |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
412 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
413 OCTAVE_TIME_T m_usr_sec; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
414 OCTAVE_TIME_T m_sys_sec; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
415 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
416 long m_usr_usec; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
417 long m_sys_usec; |
21930
f0c5dd1ea2b9
hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents:
21752
diff
changeset
|
418 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
419 cpu_time (OCTAVE_TIME_T usr_sec, OCTAVE_TIME_T sys_sec, long usr_usec, long sys_usec) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
420 : m_usr_sec (usr_sec), m_sys_sec (sys_sec), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
421 m_usr_usec (usr_usec), m_sys_usec (sys_usec) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
422 { } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
423 }; |
21930
f0c5dd1ea2b9
hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents:
21752
diff
changeset
|
424 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
425 class |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
426 resource_usage |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
427 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
428 public: |
21930
f0c5dd1ea2b9
hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents:
21752
diff
changeset
|
429 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
430 resource_usage () |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
431 : m_cpu (), m_maxrss (0), m_ixrss (0), m_idrss (0), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
432 m_isrss (0), m_minflt (0), m_majflt (0), m_nswap (0), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
433 m_inblock (0), m_oublock (0), m_msgsnd (0), m_msgrcv (0), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
434 m_nsignals (0), m_nvcsw (0), m_nivcsw (0) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
435 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
436 stamp (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
437 } |
21930
f0c5dd1ea2b9
hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents:
21752
diff
changeset
|
438 |
31855
1daf8bfceac3
default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents:
31771
diff
changeset
|
439 OCTAVE_DEFAULT_COPY_MOVE_DELETE (resource_usage) |
21930
f0c5dd1ea2b9
hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents:
21752
diff
changeset
|
440 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
441 OCTAVE_API void stamp (); |
21930
f0c5dd1ea2b9
hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents:
21752
diff
changeset
|
442 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
443 cpu_time cpu () const { return m_cpu; } |
21930
f0c5dd1ea2b9
hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents:
21752
diff
changeset
|
444 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
445 long maxrss () const { return m_maxrss; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
446 long ixrss () const { return m_ixrss; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
447 long idrss () const { return m_idrss; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
448 long isrss () const { return m_isrss; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
449 long minflt () const { return m_minflt; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
450 long majflt () const { return m_majflt; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
451 long nswap () const { return m_nswap; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
452 long inblock () const { return m_inblock; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
453 long oublock () const { return m_oublock; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
454 long msgsnd () const { return m_msgsnd; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
455 long msgrcv () const { return m_msgrcv; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
456 long nsignals () const { return m_nsignals; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
457 long nvcsw () const { return m_nvcsw; } |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
458 long nivcsw () const { return m_nivcsw; } |
21930
f0c5dd1ea2b9
hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents:
21752
diff
changeset
|
459 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
460 private: |
21930
f0c5dd1ea2b9
hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents:
21752
diff
changeset
|
461 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
462 cpu_time m_cpu; |
21930
f0c5dd1ea2b9
hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents:
21752
diff
changeset
|
463 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
464 long m_maxrss; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
465 long m_ixrss; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
466 long m_idrss; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
467 long m_isrss; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
468 long m_minflt; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
469 long m_majflt; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
470 long m_nswap; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
471 long m_inblock; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
472 long m_oublock; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
473 long m_msgsnd; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
474 long m_msgrcv; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
475 long m_nsignals; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
476 long m_nvcsw; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
477 long m_nivcsw; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
478 }; |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30826
diff
changeset
|
479 |
32090
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
480 // class to handle file time efficiently on different platforms |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
481 |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
482 class OCTAVE_API file_time |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
483 { |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
484 public: |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
485 |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
486 file_time (); |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
487 |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
488 file_time (OCTAVE_TIME_T t) |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
489 : m_time (t) |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
490 { } |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
491 |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
492 #if defined (OCTAVE_USE_WINDOWS_API) |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
493 file_time (OCTAVE_WIN_FILETIME& t) |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
494 { |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
495 m_time = (static_cast<OCTAVE_TIME_T> (t.dwHighDateTime)) >> 32 |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
496 | t.dwLowDateTime; |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
497 } |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
498 #endif |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
499 |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
500 file_time (const std::string& filename); |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
501 |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
502 file_time (const file_time& ot) |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
503 { |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
504 m_time = ot.time (); |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
505 } |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
506 |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
507 file_time& operator = (const file_time& ot) |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
508 { |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
509 if (this != &ot) |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
510 m_time = ot.time (); |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
511 |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
512 return *this; |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
513 } |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
514 |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
515 ~file_time () = default; |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
516 |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
517 inline static file_time time_resolution () |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
518 { |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
519 #if defined (OCTAVE_USE_WINDOWS_API) |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
520 // FAT file systems have 2 seconds resolution for the modification time. |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
521 static OCTAVE_TIME_T time_resolution = 20000; |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
522 #else |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
523 // Assume 1 second (see file_stat) |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
524 static OCTAVE_TIME_T time_resolution = 1; |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
525 #endif |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
526 return time_resolution; |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
527 } |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
528 |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
529 inline bool |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
530 operator == (const file_time& t2) const |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
531 { |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
532 return time () == t2.time (); |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
533 } |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
534 |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
535 inline bool |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
536 operator != (const file_time& t2) const |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
537 { |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
538 return ! (*this == t2); |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
539 } |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
540 |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
541 inline bool |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
542 operator < (const file_time& t2) const |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
543 { |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
544 return time () < t2.time (); |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
545 } |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
546 |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
547 inline bool |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
548 operator <= (const file_time& t2) const |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
549 { |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
550 return (*this < t2 || *this == t2); |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
551 } |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
552 |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
553 inline bool |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
554 operator > (const file_time& t2) const |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
555 { |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
556 return time () > t2.time (); |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
557 } |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
558 |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
559 inline bool |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
560 operator >= (const file_time& t2) const |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
561 { |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
562 return (*this > t2 || *this == t2); |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
563 } |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
564 |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
565 inline file_time |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
566 operator + (const file_time& t2) const |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
567 { |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
568 return file_time (time () + t2.time ()); |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
569 } |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
570 |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
571 inline file_time |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
572 operator + (const OCTAVE_TIME_T t2) const |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
573 { |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
574 return file_time (time () + t2); |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
575 } |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
576 |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
577 OCTAVE_TIME_T time () const { return m_time; } |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
578 |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
579 private: |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
580 |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
581 // The native file time type differs per platform. |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
582 // On POSIX, this is the number of 1 second intervals since the epoch. |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
583 // On Windows, this is the number of 0.1 ms intervals since a different epoch. |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
584 OCTAVE_TIME_T m_time; |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
585 }; |
7d663f770c5a
load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31855
diff
changeset
|
586 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30826
diff
changeset
|
587 OCTAVE_END_NAMESPACE(sys) |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30826
diff
changeset
|
588 OCTAVE_END_NAMESPACE(octave) |
9748
d6b2b708b6b0
load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents:
7231
diff
changeset
|
589 |
3253 | 590 #endif |