comparison liboctave/oct-time.cc @ 3706:6581e686f83f

[project @ 2000-07-25 05:30:02 by jwe]
author jwe
date Tue, 25 Jul 2000 05:30:02 +0000
parents aef06675c94d
children c73bea82af94
comparison
equal deleted inserted replaced
3705:7e90f4e9a4d5 3706:6581e686f83f
22 22
23 #ifdef HAVE_CONFIG_H 23 #ifdef HAVE_CONFIG_H
24 #include <config.h> 24 #include <config.h>
25 #endif 25 #endif
26 26
27 #if 0
28
29 // The following definitions are commented out because they cause
30 // trouble on some systems. What is really needed is a feature test
31 // in the configure script.
32
33 // I am told that without _BSD_SOURCE, tm_zone won't be declared on
34 // some systems. Defining _XOPEN_SOURCE provides the declaration for
35 // strptime on some others.
36 //
37 // These defines go here, before any system header files are included,
38 // because the system header files may define other macros that are
39 // actually used to determine the feature set. If we wait until after
40 // some system header file is included, it may be too late.
41
42 #if !defined (_BSD_SOURCE)
43 #define _BSD_SOURCE 1
44 #define OCTAVE_UNDEFINE_BSD_SOURCE
45 #endif
46
47 #if !defined (_XOPEN_SOURCE)
48 #define _XOPEN_SOURCE 1
49 #define OCTAVE_UNDEFINE_XOPEN_SOURCE
50 #endif
51
52 #endif
53
54 #include <climits> 27 #include <climits>
55 #include <cmath> 28 #include <cmath>
56 29
57 #ifdef HAVE_UNISTD_H 30 #ifdef HAVE_UNISTD_H
58 #ifdef HAVE_SYS_TYPES_H 31 #ifdef HAVE_SYS_TYPES_H
62 #endif 35 #endif
63 36
64 #include "lo-error.h" 37 #include "lo-error.h"
65 #include "lo-utils.h" 38 #include "lo-utils.h"
66 #include "oct-time.h" 39 #include "oct-time.h"
67
68 #if defined (OCTAVE_UNDEFINE_BSD_SOURCE)
69 #undef _BSD_SOURCE
70 #endif
71
72 #if defined (OCTAVE_UNDEFINE_XOPEN_SOURCE)
73 #undef _XOPEN_SOURCE
74 #endif
75
76 #if !defined (HAVE_STRPTIME)
77 extern "C" char *strptime (const char *buf, const char *format, struct tm *tm);
78 #endif
79 40
80 octave_time::octave_time (const octave_base_tm& tm) 41 octave_time::octave_time (const octave_base_tm& tm)
81 { 42 {
82 struct tm t; 43 struct tm t;
83 44
284 t.tm_zone = ps; 245 t.tm_zone = ps;
285 #endif 246 #endif
286 247
287 char *p = strsave (str.c_str ()); 248 char *p = strsave (str.c_str ());
288 249
289 char *q = strptime (p, fmt.c_str (), &t); 250 char *q = oct_strptime (p, fmt.c_str (), &t);
290 251
291 nchars = p - q; 252 nchars = p - q;
292 253
293 delete [] p; 254 delete [] p;
294 255