comparison src/timefns.cc @ 2086:bfb775fb6fe8

[project @ 1996-04-25 05:55:19 by jwe]
author jwe
date Thu, 25 Apr 1996 05:55:19 +0000
parents 003570e69c7b
children 7c60f8a6e6a0
comparison
equal deleted inserted replaced
2085:7603b37325db 2086:bfb775fb6fe8
126 \n\ 126 \n\
127 Given a value returned from time(), return a structure like that\n\ 127 Given a value returned from time(), return a structure like that\n\
128 returned from localtime() but with values corresponding to\n\ 128 returned from localtime() but with values corresponding to\n\
129 Coordinated Universal Time (UTC).") 129 Coordinated Universal Time (UTC).")
130 { 130 {
131 Octave_object retval; 131 octave_value_list retval;
132 132
133 if (args.length () == 1) 133 if (args.length () == 1)
134 { 134 {
135 double tmp = args(0).double_value (); 135 double tmp = args(0).double_value ();
136 136
138 { 138 {
139 time_t timeval = NINT (tmp); 139 time_t timeval = NINT (tmp);
140 double ip; 140 double ip;
141 double fraction = modf (tmp, &ip); 141 double fraction = modf (tmp, &ip);
142 142
143 retval = tree_constant (mk_tm_map (gmtime (&timeval), fraction)); 143 retval = octave_value (mk_tm_map (gmtime (&timeval), fraction));
144 } 144 }
145 } 145 }
146 else 146 else
147 print_usage ("gmtime"); 147 print_usage ("gmtime");
148 148
165 wday : days since Sunday (0, 6)\n\ 165 wday : days since Sunday (0, 6)\n\
166 yday : days since January 1 (0, 365)\n\ 166 yday : days since January 1 (0, 365)\n\
167 isdst : Daylight Savings Time flag\n\ 167 isdst : Daylight Savings Time flag\n\
168 zone : Time zone") 168 zone : Time zone")
169 { 169 {
170 Octave_object retval; 170 octave_value_list retval;
171 171
172 if (args.length () == 1) 172 if (args.length () == 1)
173 { 173 {
174 double tmp = args(0).double_value (); 174 double tmp = args(0).double_value ();
175 175
177 { 177 {
178 time_t timeval = NINT (tmp); 178 time_t timeval = NINT (tmp);
179 double ip; 179 double ip;
180 double fraction = modf (tmp, &ip); 180 double fraction = modf (tmp, &ip);
181 181
182 retval = tree_constant (mk_tm_map (localtime (&timeval), fraction)); 182 retval = octave_value (mk_tm_map (localtime (&timeval), fraction));
183 } 183 }
184 } 184 }
185 else 185 else
186 print_usage ("localtime"); 186 print_usage ("localtime");
187 187
189 } 189 }
190 190
191 DEFUN (mktime, args, , 191 DEFUN (mktime, args, ,
192 "mktime (TMSTRUCT)") 192 "mktime (TMSTRUCT)")
193 { 193 {
194 Octave_object retval; 194 octave_value_list retval;
195 195
196 if (args.length () == 1 && args(0).is_map ()) 196 if (args.length () == 1 && args(0).is_map ())
197 { 197 {
198 Octave_map map = args(0).map_value (); 198 Octave_map map = args(0).map_value ();
199 199
269 %W week number of year with Monday as first day of week (00..53)\n\ 269 %W week number of year with Monday as first day of week (00..53)\n\
270 %x locale's date representation (mm/dd/yy)\n\ 270 %x locale's date representation (mm/dd/yy)\n\
271 %y last two digits of year (00..99)\n\ 271 %y last two digits of year (00..99)\n\
272 %Y year (1970...)") 272 %Y year (1970...)")
273 { 273 {
274 Octave_object retval; 274 octave_value_list retval;
275 275
276 if (args.length () == 2 && args(0).is_string () && args(1).is_map ()) 276 if (args.length () == 2 && args(0).is_string () && args(1).is_map ())
277 { 277 {
278 string fmt = args(0).string_value (); 278 string fmt = args(0).string_value ();
279 279