annotate liboctave/system/oct-time.h @ 32628:ae4e19c0a2b1

maint: Place class name and class keyword on one line. * libinterp/corefcn/Cell.h, libinterp/corefcn/__magick_read__.cc, libinterp/corefcn/auto-shlib.h, libinterp/corefcn/base-text-renderer.h, libinterp/corefcn/c-file-ptr-stream.h, libinterp/corefcn/call-stack.h, libinterp/corefcn/dynamic-ld.h, libinterp/corefcn/event-manager.h, libinterp/corefcn/event-queue.h, libinterp/corefcn/ft-text-renderer.cc, libinterp/corefcn/gl-render.cc, libinterp/corefcn/gl-render.h, libinterp/corefcn/gl2ps-print.cc, libinterp/corefcn/graphics.cc, libinterp/corefcn/graphics.in.h, libinterp/corefcn/input.cc, libinterp/corefcn/latex-text-renderer.cc, libinterp/corefcn/load-path.h, libinterp/corefcn/mx-type-traits.h, libinterp/corefcn/oct-errno.h, libinterp/corefcn/oct-fstrm.h, libinterp/corefcn/oct-iostrm.h, libinterp/corefcn/oct-prcstrm.h, libinterp/corefcn/oct-procbuf.h, libinterp/corefcn/oct-process.h, libinterp/corefcn/oct-stdstrm.h, libinterp/corefcn/oct-stream.cc, libinterp/corefcn/oct-stream.h, libinterp/corefcn/oct-strstrm.h, libinterp/corefcn/pager.h, libinterp/corefcn/pr-flt-fmt.h, libinterp/corefcn/pr-output.cc, libinterp/corefcn/pr-output.h, libinterp/corefcn/procstream.h, libinterp/corefcn/syminfo.h, libinterp/corefcn/text-engine.h, libinterp/corefcn/text-renderer.h, libinterp/corefcn/utils.h, libinterp/octave-value/cdef-class.h, libinterp/octave-value/cdef-manager.h, libinterp/octave-value/cdef-method.h, libinterp/octave-value/cdef-object.h, libinterp/octave-value/cdef-package.h, libinterp/octave-value/cdef-property.h, libinterp/octave-value/ov-base-diag.h, libinterp/octave-value/ov-base-int.h, libinterp/octave-value/ov-base-mat.h, libinterp/octave-value/ov-base-scalar.h, libinterp/octave-value/ov-base-sparse.h, libinterp/octave-value/ov-base.h, libinterp/octave-value/ov-bool-mat.h, libinterp/octave-value/ov-bool-sparse.h, libinterp/octave-value/ov-bool.h, libinterp/octave-value/ov-builtin.h, libinterp/octave-value/ov-cell.h, libinterp/octave-value/ov-ch-mat.h, libinterp/octave-value/ov-class.cc, libinterp/octave-value/ov-class.h, libinterp/octave-value/ov-classdef.h, libinterp/octave-value/ov-colon.h, libinterp/octave-value/ov-complex.h, libinterp/octave-value/ov-cs-list.h, libinterp/octave-value/ov-cx-diag.h, libinterp/octave-value/ov-cx-mat.h, libinterp/octave-value/ov-cx-sparse.h, libinterp/octave-value/ov-dld-fcn.h, libinterp/octave-value/ov-fcn-handle.h, libinterp/octave-value/ov-fcn.h, libinterp/octave-value/ov-float.h, libinterp/octave-value/ov-flt-complex.h, libinterp/octave-value/ov-flt-cx-diag.h, libinterp/octave-value/ov-flt-cx-mat.h, libinterp/octave-value/ov-flt-re-diag.h, libinterp/octave-value/ov-flt-re-mat.h, libinterp/octave-value/ov-int-traits.h, libinterp/octave-value/ov-intx.h, libinterp/octave-value/ov-lazy-idx.h, libinterp/octave-value/ov-legacy-range.cc, libinterp/octave-value/ov-legacy-range.h, libinterp/octave-value/ov-magic-int.h, libinterp/octave-value/ov-mex-fcn.h, libinterp/octave-value/ov-null-mat.h, libinterp/octave-value/ov-perm.h, libinterp/octave-value/ov-range-traits.h, libinterp/octave-value/ov-range.h, libinterp/octave-value/ov-re-diag.h, libinterp/octave-value/ov-re-mat.h, libinterp/octave-value/ov-re-sparse.h, libinterp/octave-value/ov-scalar.h, libinterp/octave-value/ov-str-mat.h, libinterp/octave-value/ov-struct.h, libinterp/octave-value/ov-typeinfo.h, libinterp/octave-value/ov-usr-fcn.h, libinterp/octave-value/ov.h, libinterp/octave-value/ovl.h, libinterp/parse-tree/comment-list.h, libinterp/parse-tree/lex.h, libinterp/parse-tree/profiler.h, libinterp/parse-tree/pt-anon-scopes.h, liboctave/array/Array.h, liboctave/array/CColVector.h, liboctave/array/CDiagMatrix.h, liboctave/array/CMatrix.h, liboctave/array/CNDArray.h, liboctave/array/CRowVector.h, liboctave/array/CSparse.h, liboctave/array/DiagArray2.h, liboctave/array/MArray.h, liboctave/array/MDiagArray2.h, liboctave/array/MSparse.h, liboctave/array/MatrixType.h, liboctave/array/Range.h, liboctave/array/Sparse.h, liboctave/array/boolMatrix.h, liboctave/array/boolNDArray.h, liboctave/array/boolSparse.h, liboctave/array/chMatrix.h, liboctave/array/chNDArray.h, liboctave/array/dColVector.h, liboctave/array/dDiagMatrix.h, liboctave/array/dMatrix.h, liboctave/array/dNDArray.h, liboctave/array/dRowVector.h, liboctave/array/dSparse.h, liboctave/array/dim-vector.h, liboctave/array/fCColVector.h, liboctave/array/fCDiagMatrix.h, liboctave/array/fCMatrix.h, liboctave/array/fCNDArray.h, liboctave/array/fCRowVector.h, liboctave/array/fColVector.h, liboctave/array/fDiagMatrix.h, liboctave/array/fMatrix.h, liboctave/array/fNDArray.h, liboctave/array/fRowVector.h, liboctave/array/idx-vector.h, liboctave/array/intNDArray.h, liboctave/numeric/DAE.h, liboctave/numeric/DAEFunc.h, liboctave/numeric/DAERT.h, liboctave/numeric/DAERTFunc.h, liboctave/numeric/DASPK.h, liboctave/numeric/DASRT.h, liboctave/numeric/DASSL.h, liboctave/numeric/DET.h, liboctave/numeric/EIG.h, liboctave/numeric/LSODE.h, liboctave/numeric/ODE.h, liboctave/numeric/ODEFunc.h, liboctave/numeric/ODES.h, liboctave/numeric/ODESFunc.h, liboctave/numeric/Quad.h, liboctave/numeric/aepbalance.h, liboctave/numeric/base-dae.h, liboctave/numeric/base-de.h, liboctave/numeric/chol.h, liboctave/numeric/fEIG.h, liboctave/numeric/gepbalance.h, liboctave/numeric/gsvd.h, liboctave/numeric/hess.h, liboctave/numeric/lu.h, liboctave/numeric/oct-fftw.h, liboctave/numeric/qr.h, liboctave/numeric/qrp.h, liboctave/numeric/schur.h, liboctave/numeric/sparse-chol.h, liboctave/numeric/sparse-lu.h, liboctave/numeric/sparse-qr.cc, liboctave/numeric/sparse-qr.h, liboctave/numeric/svd.cc, liboctave/numeric/svd.h, liboctave/system/dir-ops.h, liboctave/system/file-stat.h, liboctave/system/oct-env.h, liboctave/system/oct-group.h, liboctave/system/oct-password.h, liboctave/system/oct-time.h, liboctave/system/oct-uname.h, liboctave/util/action-container.h, liboctave/util/base-list.h, liboctave/util/cmd-edit.cc, liboctave/util/cmd-edit.h, liboctave/util/cmd-hist.cc, liboctave/util/cmd-hist.h, liboctave/util/data-conv.h, liboctave/util/glob-match.h, liboctave/util/lo-regexp.h, liboctave/util/oct-inttypes.h, liboctave/util/oct-mutex.cc, liboctave/util/oct-mutex.h, liboctave/util/oct-shlib.cc, liboctave/util/oct-shlib.h, liboctave/util/oct-sort.h, liboctave/util/oct-string.h, liboctave/util/octave-preserve-stream-state.h, liboctave/util/pathsearch.h, liboctave/util/singleton-cleanup.h, liboctave/util/str-vec.h, liboctave/util/unwind-prot.h, liboctave/util/url-transfer.h: Place class name and class keyword on one line.
author Rik <rik@octave.org>
date Thu, 21 Dec 2023 11:22:26 -0800
parents 7d663f770c5a
children 4b601ca024d5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
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
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
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
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
32 #include <string>
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
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
32628
ae4e19c0a2b1 maint: Place class name and class keyword on one line.
Rik <rik@octave.org>
parents: 32090
diff changeset
62 class time
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
63 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
64 public:
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
65
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
66 time ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
67 : 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
68
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
69 time (OCTAVE_TIME_T t)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
70 : 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
71
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
72 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
73 : 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
74 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
75 long rem, extra;
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
76
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
77 if (us >= 0)
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22323
diff changeset
78 {
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
79 rem = us % 1000000;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
80 extra = (us - rem) / 1000000;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
81 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
82 else
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
83 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
84 us = -us;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
85 rem = us % 1000000;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
86 extra = - (1 + (us - rem) / 1000000);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
87 rem = 1000000 - us % 1000000;
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22323
diff changeset
88 }
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
89
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
90 m_ot_usec = rem;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
91 m_ot_unix_time += extra;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
92 }
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
93
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
94 OCTAVE_API time (double d);
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
95
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
96 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
97
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
98 time (const time& ot)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
99 : 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
100
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
101 time& operator = (const time& ot)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
102 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
103 if (this != &ot)
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22323
diff changeset
104 {
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
105 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
106 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
107 }
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
108
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
109 return *this;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
110 }
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
111
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
112 ~time () = default;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
113
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
114 OCTAVE_API void stamp ();
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
115
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
116 double double_value () const
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
117 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
118 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
119 }
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
120
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
121 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
122
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
123 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
124
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
125 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
126
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
127 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
128
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
129 private:
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
130
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
131 // Seconds since the epoch.
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
132 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
133
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
134 // Additional microseconds.
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
135 long m_ot_usec;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
136 };
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
137
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
138 inline bool
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
139 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
140 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
141 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
142 }
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 inline bool
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
145 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
146 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
147 return ! (t1 == t2);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
148 }
9748
d6b2b708b6b0 load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents: 7231
diff changeset
149
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
150 inline bool
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
151 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
152 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
153 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
154 return true;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
155 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
156 return false;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
157 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
158 return true;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
159 else
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
160 return false;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
161 }
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
162
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
163 inline bool
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
164 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
165 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
166 return (t1 < t2 || t1 == t2);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
167 }
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
168
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
169 inline bool
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
170 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
171 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
172 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
173 return true;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
174 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
175 return false;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
176 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
177 return true;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
178 else
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
179 return false;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
180 }
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
181
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
182 inline bool
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
183 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
184 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
185 return (t1 > t2 || t1 == t2);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
186 }
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
187
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
188 inline time
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
189 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
190 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
191 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
192 t1.usec () + t2.usec ());
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
193 }
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
194
32628
ae4e19c0a2b1 maint: Place class name and class keyword on one line.
Rik <rik@octave.org>
parents: 32090
diff changeset
195 class base_tm
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
196 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
197 public:
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
198
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
199 base_tm ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
200 : 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
201 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
202 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
203 { }
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
204
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
205 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
206 : 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
207 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
208 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
209 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
210 { }
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
211
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
212 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
213 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
214 if (this != &tm)
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22323
diff changeset
215 {
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
216 m_usec = tm.m_usec;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
217 m_sec = tm.m_sec;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
218 m_min = tm.m_min;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
219 m_hour = tm.m_hour;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
220 m_mday = tm.m_mday;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
221 m_mon = tm.m_mon;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
222 m_year = tm.m_year;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
223 m_wday = tm.m_wday;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
224 m_yday = tm.m_yday;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
225 m_isdst = tm.m_isdst;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
226 m_gmtoff = tm.m_gmtoff;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
227 m_zone = tm.m_zone;
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22323
diff changeset
228 }
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
229
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
230 return *this;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
231 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
232
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
233 virtual ~base_tm () = default;
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
234
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
235 int usec () const { return m_usec; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
236 int sec () const { return m_sec; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
237 int min () const { return m_min; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
238 int hour () const { return m_hour; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
239 int mday () const { return m_mday; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
240 int mon () const { return m_mon; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
241 int year () const { return m_year; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
242 int wday () const { return m_wday; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
243 int yday () const { return m_yday; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
244 int isdst () const { return m_isdst; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
245 long gmtoff () const { return m_gmtoff; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
246 std::string zone () const { return m_zone; }
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
247
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
248 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
249 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
250 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
251 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
252 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
253 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
254 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
255 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
256 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
257 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
258 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
259 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
260
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
261 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
262
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
263 std::string asctime () const
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
264 { 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
265
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
266 protected:
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 // 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
269 int m_usec;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
270
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
271 // 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
272 int m_sec;
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
273
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
274 // 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
275 int m_min;
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
276
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
277 // Hours since midnight (0, 23).
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
278 int m_hour;
3255
4d33b1e56bff [project @ 1999-07-15 20:54:14 by jwe]
jwe
parents: 3253
diff changeset
279
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
280 // 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
281 int m_mday;
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
282
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
283 // Months since January (0, 11).
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
284 int m_mon;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
285
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
286 // Years since 1900.
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
287 int m_year;
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
288
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
289 // Days since Sunday (0, 6).
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
290 int m_wday;
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
291
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
292 // 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
293 int m_yday;
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
294
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
295 // Daylight saving time flag.
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
296 int m_isdst;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
297
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
298 // Time zone.
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
299 long m_gmtoff;
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
300
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
301 // Time zone.
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
302 std::string m_zone;
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
303
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
304 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
305 };
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
306
32628
ae4e19c0a2b1 maint: Place class name and class keyword on one line.
Rik <rik@octave.org>
parents: 32090
diff changeset
307 class localtime : public base_tm
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
308 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
309 public:
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
310
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
311 localtime ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
312 : base_tm () { init (time ()); }
3255
4d33b1e56bff [project @ 1999-07-15 20:54:14 by jwe]
jwe
parents: 3253
diff changeset
313
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
314 localtime (const time& ot)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
315 : base_tm () { init (ot); }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
316
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
317 localtime (const localtime& t)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
318 : base_tm (t) { }
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
319
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
320 localtime& operator = (const localtime& t)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
321 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
322 base_tm::operator = (t);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
323 return *this;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
324 }
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
325
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
326 ~localtime () = default;
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
327
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
328 private:
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
329
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
330 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
331 };
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
332
32628
ae4e19c0a2b1 maint: Place class name and class keyword on one line.
Rik <rik@octave.org>
parents: 32090
diff changeset
333 class gmtime : public base_tm
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
334 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
335 public:
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
336
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
337 gmtime ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
338 : base_tm () { init (time ()); }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
339
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
340 gmtime (const time& ot)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
341 : base_tm () { init (ot); }
3255
4d33b1e56bff [project @ 1999-07-15 20:54:14 by jwe]
jwe
parents: 3253
diff changeset
342
31855
1daf8bfceac3 default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents: 31771
diff changeset
343 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
344
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
345 private:
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
346
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
347 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
348 };
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
349
32628
ae4e19c0a2b1 maint: Place class name and class keyword on one line.
Rik <rik@octave.org>
parents: 32090
diff changeset
350 class strptime : public base_tm
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
351 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
352 public:
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
353
31855
1daf8bfceac3 default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents: 31771
diff changeset
354 strptime () = delete;
1daf8bfceac3 default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents: 31771
diff changeset
355
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
356 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
357 : base_tm (), m_nchars (0)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
358 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
359 init (str, fmt);
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
360 }
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
361
31855
1daf8bfceac3 default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents: 31771
diff changeset
362 OCTAVE_DEFAULT_COPY_MOVE_DELETE (strptime)
3255
4d33b1e56bff [project @ 1999-07-15 20:54:14 by jwe]
jwe
parents: 3253
diff changeset
363
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
364 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
365
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
366 private:
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
367
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
368 int m_nchars;
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
369
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
370 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
371 };
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
372
32628
ae4e19c0a2b1 maint: Place class name and class keyword on one line.
Rik <rik@octave.org>
parents: 32090
diff changeset
373 class cpu_time
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
374 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
375 public:
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
376
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
377 friend class resource_usage;
3255
4d33b1e56bff [project @ 1999-07-15 20:54:14 by jwe]
jwe
parents: 3253
diff changeset
378
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
379 cpu_time ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
380 : 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
381 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
382 stamp ();
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
383 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
384
31855
1daf8bfceac3 default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents: 31771
diff changeset
385 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
386
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
387 OCTAVE_API void stamp ();
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
388
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
389 double user () const
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
390 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
391 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
392 }
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
393
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
394 double system () const
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
395 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
396 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
397 }
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
398
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
399 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
400 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
401
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
402 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
403 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
404
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
405 private:
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
406
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
407 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
408 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
409
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
410 long m_usr_usec;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
411 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
412
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
413 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
414 : 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
415 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
416 { }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
417 };
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
32628
ae4e19c0a2b1 maint: Place class name and class keyword on one line.
Rik <rik@octave.org>
parents: 32090
diff changeset
419 class resource_usage
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
420 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
421 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
422
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
423 resource_usage ()
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
424 : 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
425 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
426 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
427 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
428 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
429 stamp ();
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
430 }
21930
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
431
31855
1daf8bfceac3 default or disable more ctors, dtors, and assignment ops
John W. Eaton <jwe@octave.org>
parents: 31771
diff changeset
432 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
433
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
434 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
435
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
436 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
437
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
438 long maxrss () const { return m_maxrss; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
439 long ixrss () const { return m_ixrss; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
440 long idrss () const { return m_idrss; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
441 long isrss () const { return m_isrss; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
442 long minflt () const { return m_minflt; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
443 long majflt () const { return m_majflt; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
444 long nswap () const { return m_nswap; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
445 long inblock () const { return m_inblock; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
446 long oublock () const { return m_oublock; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
447 long msgsnd () const { return m_msgsnd; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
448 long msgrcv () const { return m_msgrcv; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
449 long nsignals () const { return m_nsignals; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
450 long nvcsw () const { return m_nvcsw; }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
451 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
452
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
453 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
454
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
455 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
456
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
457 long m_maxrss;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
458 long m_ixrss;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
459 long m_idrss;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
460 long m_isrss;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
461 long m_minflt;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
462 long m_majflt;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
463 long m_nswap;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
464 long m_inblock;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
465 long m_oublock;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
466 long m_msgsnd;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
467 long m_msgrcv;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
468 long m_nsignals;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
469 long m_nvcsw;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
470 long m_nivcsw;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
471 };
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30826
diff changeset
472
32090
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
473 // 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
474
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
475 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
476 {
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
477 public:
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
478
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
479 file_time ();
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
480
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
481 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
482 : 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
483 { }
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
484
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
485 #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
486 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
487 {
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
488 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
489 | t.dwLowDateTime;
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 #endif
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
492
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 (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
494
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
495 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
496 {
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
497 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
498 }
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& 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
501 {
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
502 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
503 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
504
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
505 return *this;
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
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
508 ~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
509
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
510 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
511 {
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
512 #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
513 // 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
514 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
515 #else
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
516 // 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
517 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
518 #endif
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
519 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
520 }
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
521
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
522 inline bool
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
523 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
524 {
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
525 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
526 }
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 inline bool
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
529 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
530 {
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
531 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
532 }
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 inline bool
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
535 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
536 {
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
537 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
538 }
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 inline bool
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
541 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
542 {
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
543 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
544 }
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 inline bool
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
547 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
548 {
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
549 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
550 }
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 inline bool
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
553 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
554 {
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
555 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
556 }
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 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
559 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
560 {
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
561 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
562 }
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 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
565 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
566 {
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
567 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
568 }
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 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
571
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
572 private:
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 // 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
575 // 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
576 // 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
577 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
578 };
7d663f770c5a load-path: Avoid using file_stat on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31855
diff changeset
579
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30826
diff changeset
580 OCTAVE_END_NAMESPACE(sys)
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30826
diff changeset
581 OCTAVE_END_NAMESPACE(octave)
9748
d6b2b708b6b0 load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents: 7231
diff changeset
582
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
583 #endif