comparison liboctave/oct-time.cc @ 3887:7da18459c08b

[project @ 2002-04-04 00:44:21 by jwe]
author jwe
date Thu, 04 Apr 2002 00:46:37 +0000
parents ac4609ffc702
children ee4790097033
comparison
equal deleted inserted replaced
3886:96919c87953c 3887:7da18459c08b
50 t.tm_year = tm.year (); 50 t.tm_year = tm.year ();
51 t.tm_wday = tm.wday (); 51 t.tm_wday = tm.wday ();
52 t.tm_yday = tm.yday (); 52 t.tm_yday = tm.yday ();
53 t.tm_isdst = tm.isdst (); 53 t.tm_isdst = tm.isdst ();
54 54
55 #if defined (HAVE_TM_ZONE) 55 #if defined (HAVE_STRUCT_TM_TM_ZONE)
56 std::string s = tm.zone (); 56 std::string s = tm.zone ();
57 char *ps = strsave (s.c_str ()); 57 char *ps = strsave (s.c_str ());
58 t.tm_zone = ps; 58 t.tm_zone = ps;
59 #endif 59 #endif
60 60
61 ot_unix_time = mktime (&t); 61 ot_unix_time = mktime (&t);
62 62
63 #if defined (HAVE_TM_ZONE) 63 #if defined (HAVE_STRUCT_TM_TM_ZONE)
64 delete [] ps; 64 delete [] ps;
65 #endif 65 #endif
66 66
67 ot_usec = tm.usec (); 67 ot_usec = tm.usec ();
68 } 68 }
173 t.tm_year = tm_year; 173 t.tm_year = tm_year;
174 t.tm_wday = tm_wday; 174 t.tm_wday = tm_wday;
175 t.tm_yday = tm_yday; 175 t.tm_yday = tm_yday;
176 t.tm_isdst = tm_isdst; 176 t.tm_isdst = tm_isdst;
177 177
178 #if defined (HAVE_TM_ZONE) 178 #if defined (HAVE_STRUCT_TM_TM_ZONE)
179 char *ps = strsave (tm_zone.c_str ()); 179 char *ps = strsave (tm_zone.c_str ());
180 t.tm_zone = ps; 180 t.tm_zone = ps;
181 #endif 181 #endif
182 182
183 const char *fmt_str = fmt.c_str (); 183 const char *fmt_str = fmt.c_str ();
195 chars_written = ::strftime (buf, bufsize, fmt_str, &t); 195 chars_written = ::strftime (buf, bufsize, fmt_str, &t);
196 196
197 bufsize *= 2; 197 bufsize *= 2;
198 } 198 }
199 199
200 #if defined (HAVE_TM_ZONE) 200 #if defined (HAVE_STRUCT_TM_TM_ZONE)
201 delete [] ps; 201 delete [] ps;
202 #endif 202 #endif
203 203
204 retval = buf; 204 retval = buf;
205 205
222 tm_year = t->tm_year; 222 tm_year = t->tm_year;
223 tm_wday = t->tm_wday; 223 tm_wday = t->tm_wday;
224 tm_yday = t->tm_yday; 224 tm_yday = t->tm_yday;
225 tm_isdst = t->tm_isdst; 225 tm_isdst = t->tm_isdst;
226 226
227 #if defined (HAVE_TM_ZONE) 227 #if defined (HAVE_STRUCT_TM_TM_ZONE)
228 tm_zone = t->tm_zone; 228 tm_zone = t->tm_zone;
229 #elif defined (HAVE_TZNAME) 229 #elif defined (HAVE_TZNAME)
230 if (t->tm_isdst == 0 || t->tm_isdst == 1) 230 if (t->tm_isdst == 0 || t->tm_isdst == 1)
231 tm_zone = tzname[t->tm_isdst]; 231 tm_zone = tzname[t->tm_isdst];
232 #endif 232 #endif
265 t.tm_year = 0; 265 t.tm_year = 0;
266 t.tm_wday = 0; 266 t.tm_wday = 0;
267 t.tm_yday = 0; 267 t.tm_yday = 0;
268 t.tm_isdst = 0; 268 t.tm_isdst = 0;
269 269
270 #if defined (HAVE_TM_ZONE) 270 #if defined (HAVE_STRUCT_TM_TM_ZONE)
271 char *ps = strsave (""); 271 char *ps = strsave ("");
272 t.tm_zone = ps; 272 t.tm_zone = ps;
273 #endif 273 #endif
274 274
275 char *p = strsave (str.c_str ()); 275 char *p = strsave (str.c_str ());
280 280
281 delete [] p; 281 delete [] p;
282 282
283 octave_base_tm::init (&t); 283 octave_base_tm::init (&t);
284 284
285 #if defined (HAVE_TM_ZONE) 285 #if defined (HAVE_STRUCT_TM_TM_ZONE)
286 delete ps; 286 delete ps;
287 #endif 287 #endif
288 } 288 }
289 289
290 /* 290 /*