annotate liboctave/system/oct-time.h @ 22323:bac0d6f07a3e

maint: Update copyright notices for 2016.
author John W. Eaton <jwe@octave.org>
date Wed, 17 Aug 2016 01:05:19 -0400
parents 55f7de37b618
children 4caa7b28d183
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
1 /*
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
2
22323
bac0d6f07a3e maint: Update copyright notices for 2016.
John W. Eaton <jwe@octave.org>
parents: 21937
diff changeset
3 Copyright (C) 1999-2016 John W. Eaton
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
4
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
6
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6108
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6108
diff changeset
10 option) any later version.
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
11
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
15 for more details.
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
16
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6108
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6108
diff changeset
19 <http://www.gnu.org/licenses/>.
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
20
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
21 */
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
22
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19697
diff changeset
23 #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
24 #define octave_oct_time_h 1
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
25
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21218
diff changeset
26 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21218
diff changeset
27
10240
fa7b5751730c use gnulib time, sys_time, and sys_times modules
John W. Eaton <jwe@octave.org>
parents: 10158
diff changeset
28 #include <ctime>
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
29 #include <string>
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
30
21734
11af9c03400c write namespace keyword and name on same line in C++ files
John W. Eaton <jwe@octave.org>
parents: 21730
diff changeset
31 namespace octave
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
32 {
21734
11af9c03400c write namespace keyword and name on same line in C++ files
John W. Eaton <jwe@octave.org>
parents: 21730
diff changeset
33 namespace sys
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
34 {
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
35 class base_tm;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
36
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
37 class
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
38 OCTAVE_API
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
39 time
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
40 {
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
41 public:
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
42
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
43 time (void)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
44 : ot_unix_time (0), ot_usec (0) { stamp (); }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
45
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
46 time (time_t t)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
47 : ot_unix_time (t), ot_usec (0) { }
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
48
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
49 time (time_t t, int us)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
50 : ot_unix_time (t), ot_usec ()
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
51 {
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
52 int rem, extra;
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
53
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
54 if (us >= 0)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
55 {
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
56 rem = us % 1000000;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
57 extra = (us - rem) / 1000000;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
58 }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
59 else
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
60 {
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
61 us = -us;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
62 rem = us % 1000000;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
63 extra = - (1 + (us - rem) / 1000000);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
64 rem = 1000000 - us % 1000000;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
65 }
3255
4d33b1e56bff [project @ 1999-07-15 20:54:14 by jwe]
jwe
parents: 3253
diff changeset
66
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
67 ot_usec = rem;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
68 ot_unix_time += extra;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
69 }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
70
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
71 time (double d);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
72
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
73 time (const base_tm& tm);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
74
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
75 time (const time& ot)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
76 : ot_unix_time (ot.ot_unix_time), ot_usec (ot.ot_usec) { }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
77
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
78 time& operator = (const time& ot)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
79 {
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
80 if (this != &ot)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
81 {
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
82 ot_unix_time = ot.ot_unix_time;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
83 ot_usec = ot.ot_usec;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
84 }
9748
d6b2b708b6b0 load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents: 7231
diff changeset
85
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
86 return *this;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
87 }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
88
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
89 ~time (void) { }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
90
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
91 void stamp (void);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
92
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
93 double double_value (void) const { return ot_unix_time + ot_usec / 1e6; }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
94
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
95 time_t unix_time (void) const { return ot_unix_time; }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
96
21930
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
97 long usec (void) const { return ot_usec; }
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
98
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
99 std::string ctime (void) const;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
100
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
101 private:
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
102
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
103 // Seconds since the epoch.
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
104 time_t ot_unix_time;
9748
d6b2b708b6b0 load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents: 7231
diff changeset
105
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
106 // Additional microseconds.
21930
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
107 long ot_usec;
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
108 };
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
109
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
110 inline bool
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
111 operator == (const time& t1, const time& t2)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
112 {
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
113 return (t1.unix_time () == t2.unix_time () && t1.usec () == t2.usec ());
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
114 }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
115
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
116 inline bool
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
117 operator != (const time& t1, const time& t2)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
118 {
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
119 return ! (t1 == t2);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
120 }
9748
d6b2b708b6b0 load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents: 7231
diff changeset
121
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
122 inline bool
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
123 operator < (const time& t1, const time& t2)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
124 {
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
125 if (t1.unix_time () < t2.unix_time ())
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
126 return true;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
127 else if (t1.unix_time () > t2.unix_time ())
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
128 return false;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
129 else if (t1.usec () < t2.usec ())
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
130 return true;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
131 else
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
132 return false;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
133 }
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
134
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
135 inline bool
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
136 operator <= (const time& t1, const time& t2)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
137 {
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
138 return (t1 < t2 || t1 == t2);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
139 }
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
140
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
141 inline bool
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
142 operator > (const time& t1, const time& t2)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
143 {
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
144 if (t1.unix_time () > t2.unix_time ())
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
145 return true;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
146 else if (t1.unix_time () < t2.unix_time ())
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
147 return false;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
148 else if (t1.usec () > t2.usec ())
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
149 return true;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
150 else
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
151 return false;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
152 }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
153
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
154 inline bool
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
155 operator >= (const time& t1, const time& t2)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
156 {
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
157 return (t1 > t2 || t1 == t2);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
158 }
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
159
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
160 inline time
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
161 operator + (const time& t1, const time& t2)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
162 {
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
163 return time (t1.unix_time () + t2.unix_time (),
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
164 t1.usec () + t2.usec ());
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
165 }
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
166
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
167 class
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
168 OCTAVE_API
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
169 base_tm
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
170 {
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
171 public:
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
172
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
173 base_tm (void)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
174 : m_usec (0), m_sec (0), m_min (0), m_hour (0),
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
175 m_mday (0), m_mon (0), m_year (0), m_wday (0),
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
176 m_yday (0), m_isdst (0), m_gmtoff (0), m_zone ("unknown")
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
177 { }
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
178
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
179 base_tm (const base_tm& tm)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
180 : m_usec (tm.m_usec), m_sec (tm.m_sec), m_min (tm.m_min),
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
181 m_hour (tm.m_hour), m_mday (tm.m_mday), m_mon (tm.m_mon),
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
182 m_year (tm.m_year), m_wday (tm.m_wday), m_yday (tm.m_yday),
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
183 m_isdst (tm.m_isdst), m_gmtoff (tm.m_gmtoff), m_zone (tm.m_zone)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
184 { }
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
185
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
186 base_tm& operator = (const base_tm& tm)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
187 {
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
188 if (this != &tm)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
189 {
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
190 m_usec = tm.m_usec;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
191 m_sec = tm.m_sec;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
192 m_min = tm.m_min;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
193 m_hour = tm.m_hour;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
194 m_mday = tm.m_mday;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
195 m_mon = tm.m_mon;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
196 m_year = tm.m_year;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
197 m_wday = tm.m_wday;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
198 m_yday = tm.m_yday;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
199 m_isdst = tm.m_isdst;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
200 m_gmtoff = tm.m_gmtoff;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
201 m_zone = tm.m_zone;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
202 }
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
203
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
204 return *this;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
205 }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
206
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
207 virtual ~base_tm (void) { }
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
208
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
209 int usec (void) const { return m_usec; }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
210 int sec (void) const { return m_sec; }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
211 int min (void) const { return m_min; }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
212 int hour (void) const { return m_hour; }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
213 int mday (void) const { return m_mday; }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
214 int mon (void) const { return m_mon; }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
215 int year (void) const { return m_year; }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
216 int wday (void) const { return m_wday; }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
217 int yday (void) const { return m_yday; }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
218 int isdst (void) const { return m_isdst; }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
219 long gmtoff (void) const { return m_gmtoff; }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
220 std::string zone (void) const { return m_zone; }
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
221
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
222 base_tm& usec (int v);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
223 base_tm& sec (int v);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
224 base_tm& min (int v);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
225 base_tm& hour (int v);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
226 base_tm& mday (int v);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
227 base_tm& mon (int v);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
228 base_tm& year (int v);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
229 base_tm& wday (int v);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
230 base_tm& yday (int v);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
231 base_tm& isdst (int v);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
232 base_tm& gmtoff (long v);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
233 base_tm& zone (const std::string& s);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
234
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
235 std::string strftime (const std::string& fmt) const;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
236
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
237 std::string asctime (void) const
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
238 { return strftime ("%a %b %d %H:%M:%S %Y\n"); }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
239
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
240 protected:
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
241
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
242 // Microseconds after the second (0, 999999).
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
243 int m_usec;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
244
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
245 // Seconds after the minute (0, 61).
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
246 int m_sec;
3255
4d33b1e56bff [project @ 1999-07-15 20:54:14 by jwe]
jwe
parents: 3253
diff changeset
247
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
248 // Minutes after the hour (0, 59).
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
249 int m_min;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
250
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
251 // Hours since midnight (0, 23).
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
252 int m_hour;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
253
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
254 // Day of the month (1, 31).
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
255 int m_mday;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
256
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
257 // Months since January (0, 11).
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
258 int m_mon;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
259
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
260 // Years since 1900.
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
261 int m_year;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
262
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
263 // Days since Sunday (0, 6).
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
264 int m_wday;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
265
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
266 // Days since January 1 (0, 365).
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
267 int m_yday;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
268
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
269 // Daylight Savings Time flag.
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
270 int m_isdst;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
271
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
272 // Time zone.
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
273 long m_gmtoff;
3255
4d33b1e56bff [project @ 1999-07-15 20:54:14 by jwe]
jwe
parents: 3253
diff changeset
274
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
275 // Time zone.
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
276 std::string m_zone;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
277
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
278 void init (void *p);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
279 };
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
280
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
281 class
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
282 OCTAVE_API
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
283 localtime : public base_tm
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
284 {
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
285 public:
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
286
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
287 localtime (void)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
288 : base_tm () { init (time ()); }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
289
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
290 localtime (const time& ot)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
291 : base_tm () { init (ot); }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
292
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
293 localtime (const localtime& t)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
294 : base_tm (t) { }
3255
4d33b1e56bff [project @ 1999-07-15 20:54:14 by jwe]
jwe
parents: 3253
diff changeset
295
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
296 localtime& operator = (const localtime& t)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
297 {
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
298 base_tm::operator = (t);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
299 return *this;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
300 }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
301
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
302 ~localtime (void) { }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
303
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
304 private:
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
305
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
306 void init (const time& ot);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
307 };
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
308
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
309 class
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
310 OCTAVE_API
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
311 gmtime : public base_tm
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
312 {
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
313 public:
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
314
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
315 gmtime (void)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
316 : base_tm () { init (time ()); }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
317
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
318 gmtime (const time& ot)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
319 : base_tm () { init (ot); }
3255
4d33b1e56bff [project @ 1999-07-15 20:54:14 by jwe]
jwe
parents: 3253
diff changeset
320
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
321 gmtime& operator = (const gmtime& t)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
322 {
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
323 base_tm::operator = (t);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
324 return *this;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
325 }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
326
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
327 ~gmtime (void) { }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
328
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
329 private:
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
330
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
331 void init (const time& ot);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
332 };
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
333
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
334 class
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
335 OCTAVE_API
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
336 strptime : public base_tm
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
337 {
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
338 public:
3255
4d33b1e56bff [project @ 1999-07-15 20:54:14 by jwe]
jwe
parents: 3253
diff changeset
339
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
340 strptime (const std::string& str, const std::string& fmt)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
341 : base_tm (), nchars (0)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
342 {
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
343 init (str, fmt);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
344 }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
345
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
346 strptime (const strptime& s)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
347 : base_tm (s), nchars (s.nchars) { }
3255
4d33b1e56bff [project @ 1999-07-15 20:54:14 by jwe]
jwe
parents: 3253
diff changeset
348
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
349 strptime& operator = (const strptime& s)
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
350 {
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
351 base_tm::operator = (s);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
352 nchars = s.nchars;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
353 return *this;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
354 }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
355
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
356 int characters_converted (void) const { return nchars; }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
357
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
358 ~strptime (void) { }
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
359
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
360 private:
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
361
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
362 int nchars;
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
363
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
364 void init (const std::string& str, const std::string& fmt);
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
365 };
21930
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
366
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
367 class
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
368 OCTAVE_API
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
369 cpu_time
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
370 {
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
371 public:
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
372
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
373 friend class resource_usage;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
374
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
375 cpu_time (void)
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
376 : m_usr_sec (0), m_sys_sec (0), m_usr_usec (0), m_sys_usec (0)
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
377 {
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
378 stamp ();
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
379 }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
380
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
381 cpu_time (const cpu_time& tm)
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
382 : m_usr_sec (tm.m_usr_sec), m_sys_sec (tm.m_sys_sec),
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
383 m_usr_usec (tm.m_usr_usec), m_sys_usec (tm.m_sys_usec)
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
384 { }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
385
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
386 cpu_time& operator = (const cpu_time& tm)
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
387 {
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
388 if (&tm != this)
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
389 {
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
390 m_usr_sec = tm.m_usr_sec;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
391 m_sys_sec = tm.m_sys_sec;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
392 m_usr_usec = tm.m_usr_usec;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
393 m_sys_usec = tm.m_sys_usec;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
394 }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
395
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
396 return *this;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
397 }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
398
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
399 void stamp (void);
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
400
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
401 double user (void) const
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
402 {
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
403 return (static_cast<double> (m_usr_sec)
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
404 + static_cast<double> (m_sys_usec) * 1e-6);
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
405 }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
406
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
407 double system (void) const
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
408 {
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
409 return (static_cast<double> (m_sys_sec)
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
410 + static_cast<double> (m_sys_usec) * 1e-6);
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
411 }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
412
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
413 time_t user_sec (void) const { return m_usr_sec; }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
414 long user_usec (void) const { return m_usr_usec; }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
415
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
416 time_t system_sec (void) const { return m_sys_sec; }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
417 long system_usec (void) const { return m_sys_usec; }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
418
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
419 private:
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
420
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
421 time_t m_usr_sec;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
422 time_t m_sys_sec;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
423
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
424 long m_usr_usec;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
425 long m_sys_usec;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
426
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
427 cpu_time (time_t usr_sec, time_t sys_sec, long usr_usec, long sys_usec)
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
428 : m_usr_sec (usr_sec), m_sys_sec (sys_sec),
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
429 m_usr_usec (usr_usec), m_sys_usec (sys_usec)
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
430 { }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
431 };
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
432
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
433 class
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
434 resource_usage
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
435 {
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
436 public:
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
437
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
438 resource_usage (void)
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
439 : m_cpu (), m_maxrss (0), m_ixrss (0), m_idrss (0),
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
440 m_isrss (0), m_minflt (0), m_majflt (0), m_nswap (0),
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
441 m_inblock (0), m_oublock (0), m_msgsnd (0), m_msgrcv (0),
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
442 m_nsignals (0), m_nvcsw (0), m_nivcsw (0)
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
443 {
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
444 stamp ();
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
445 }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
446
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
447 resource_usage (const resource_usage& ru)
21937
55f7de37b618 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 21930
diff changeset
448 : m_cpu (ru.m_cpu), m_maxrss (ru.m_maxrss),
21930
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
449 m_ixrss (ru.m_ixrss), m_idrss (ru.m_idrss),
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
450 m_isrss (ru.m_isrss), m_minflt (ru.m_minflt),
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
451 m_majflt (ru.m_majflt), m_nswap (ru.m_nswap),
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
452 m_inblock (ru.m_inblock), m_oublock (ru.m_oublock),
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
453 m_msgsnd (ru.m_msgsnd), m_msgrcv (ru.m_msgrcv),
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
454 m_nsignals (ru.m_nsignals), m_nvcsw (ru.m_nvcsw),
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
455 m_nivcsw (ru.m_nivcsw)
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
456 { }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
457
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
458 resource_usage& operator = (const resource_usage& ru)
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
459 {
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
460 if (&ru != this)
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
461 {
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
462 m_cpu = ru.m_cpu;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
463
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
464 m_maxrss = ru.m_maxrss;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
465 m_ixrss = ru.m_ixrss;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
466 m_idrss = ru.m_idrss;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
467 m_isrss = ru.m_isrss;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
468 m_minflt = ru.m_minflt;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
469 m_majflt = ru.m_majflt;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
470 m_nswap = ru.m_nswap;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
471 m_inblock = ru.m_inblock;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
472 m_oublock = ru.m_oublock;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
473 m_msgsnd = ru.m_msgsnd;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
474 m_msgrcv = ru.m_msgrcv;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
475 m_nsignals = ru.m_nsignals;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
476 m_nvcsw = ru.m_nvcsw;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
477 m_nivcsw = ru.m_nivcsw;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
478 }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
479
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
480 return *this;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
481 }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
482
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
483 void stamp (void);
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
484
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
485 cpu_time cpu (void) const { return m_cpu; }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
486
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
487 long maxrss (void) const { return m_maxrss; }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
488 long ixrss (void) const { return m_ixrss; }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
489 long idrss (void) const { return m_idrss; }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
490 long isrss (void) const { return m_isrss; }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
491 long minflt (void) const { return m_minflt; }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
492 long majflt (void) const { return m_majflt; }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
493 long nswap (void) const { return m_nswap; }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
494 long inblock (void) const { return m_inblock; }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
495 long oublock (void) const { return m_oublock; }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
496 long msgsnd (void) const { return m_msgsnd; }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
497 long msgrcv (void) const { return m_msgrcv; }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
498 long nsignals (void) const { return m_nsignals; }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
499 long nvcsw (void) const { return m_nvcsw; }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
500 long nivcsw (void) const { return m_nivcsw; }
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
501
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
502 private:
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
503
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
504 cpu_time m_cpu;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
505
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
506 long m_maxrss;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
507 long m_ixrss;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
508 long m_idrss;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
509 long m_isrss;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
510 long m_minflt;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
511 long m_majflt;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
512 long m_nswap;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
513 long m_inblock;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
514 long m_oublock;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
515 long m_msgsnd;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
516 long m_msgrcv;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
517 long m_nsignals;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
518 long m_nvcsw;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
519 long m_nivcsw;
f0c5dd1ea2b9 hide sys/time.h, sys/times.h, and sys/resource.h headers
John W. Eaton <jwe@octave.org>
parents: 21752
diff changeset
520 };
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
521 }
9748
d6b2b708b6b0 load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents: 7231
diff changeset
522 }
d6b2b708b6b0 load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents: 7231
diff changeset
523
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
524 #if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS)
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
525
21752
949cb46e6bdb use consistent style for deprecated function/class messages
John W. Eaton <jwe@octave.org>
parents: 21734
diff changeset
526 OCTAVE_DEPRECATED ("use 'octave::sys::time' instead")
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
527 typedef octave::sys::time octave_time;
3255
4d33b1e56bff [project @ 1999-07-15 20:54:14 by jwe]
jwe
parents: 3253
diff changeset
528
21752
949cb46e6bdb use consistent style for deprecated function/class messages
John W. Eaton <jwe@octave.org>
parents: 21734
diff changeset
529 OCTAVE_DEPRECATED ("use 'octave::sys::base_tm' instead")
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
530 typedef octave::sys::base_tm octave_base_tm;
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
531
21752
949cb46e6bdb use consistent style for deprecated function/class messages
John W. Eaton <jwe@octave.org>
parents: 21734
diff changeset
532 OCTAVE_DEPRECATED ("use 'octave::sys::localtime' instead")
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
533 typedef octave::sys::localtime octave_localtime;
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
534
21752
949cb46e6bdb use consistent style for deprecated function/class messages
John W. Eaton <jwe@octave.org>
parents: 21734
diff changeset
535 OCTAVE_DEPRECATED ("use 'octave::sys::gmtime' instead")
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
536 typedef octave::sys::gmtime octave_gmtime;
3465
996bb7ea4507 [project @ 2000-01-21 07:48:25 by jwe]
jwe
parents: 3255
diff changeset
537
21752
949cb46e6bdb use consistent style for deprecated function/class messages
John W. Eaton <jwe@octave.org>
parents: 21734
diff changeset
538 OCTAVE_DEPRECATED ("use 'octave::sys::strptime' instead")
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
539 typedef octave::sys::strptime octave_strptime;
3465
996bb7ea4507 [project @ 2000-01-21 07:48:25 by jwe]
jwe
parents: 3255
diff changeset
540
3253
07d2d307c43e [project @ 1999-07-15 15:58:50 by jwe]
jwe
parents:
diff changeset
541 #endif
21730
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
542
30c53770f47e use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
543 #endif