Mercurial > hg > octave-avbm
changeset 3706:6581e686f83f
[project @ 2000-07-25 05:30:02 by jwe]
author | jwe |
---|---|
date | Tue, 25 Jul 2000 05:30:02 +0000 |
parents | 7e90f4e9a4d5 |
children | 58140935c812 |
files | liboctave/ChangeLog liboctave/lo-cutils.c liboctave/lo-utils.h liboctave/oct-time.cc |
diffstat | 4 files changed, 19 insertions(+), 40 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,9 @@ +2000-07-25 John W. Eaton <jwe@bevo.che.wisc.edu> + + * lo-cutils.c (oct_strptime): New function. + * oct-time.cc (octave_strptime::init): Call it instead of strptime. + Don't declare strptime. Don't define _XOPEN_SOURCE or _BSD_SOURCE. + 2000-07-18 John W. Eaton <jwe@bevo.che.wisc.edu> * oct-time.cc: Comment out _BSD_SOURCE and _XOPEN_SOURCE definitions.
--- a/liboctave/lo-cutils.c +++ b/liboctave/lo-cutils.c @@ -25,6 +25,7 @@ #endif #include <stdlib.h> +#include <time.h> void octave_qsort (void *base, size_t n, size_t size, @@ -33,6 +34,14 @@ qsort (base, n, size, cmp); } +extern char *strptime (); + +char * +oct_strptime (const char *buf, const char *format, struct tm *tm) +{ + return strptime (buf, format, tm); +} + /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/liboctave/lo-utils.h +++ b/liboctave/lo-utils.h @@ -39,6 +39,9 @@ extern "C" void octave_qsort (void *base, size_t n, size_t size, int (*cmp) (const void *, const void *)); +extern "C" char *oct_strptime (const char *buf, const char *format, + struct tm *tm); + #endif /*
--- a/liboctave/oct-time.cc +++ b/liboctave/oct-time.cc @@ -24,33 +24,6 @@ #include <config.h> #endif -#if 0 - -// The following definitions are commented out because they cause -// trouble on some systems. What is really needed is a feature test -// in the configure script. - -// I am told that without _BSD_SOURCE, tm_zone won't be declared on -// some systems. Defining _XOPEN_SOURCE provides the declaration for -// strptime on some others. -// -// These defines go here, before any system header files are included, -// because the system header files may define other macros that are -// actually used to determine the feature set. If we wait until after -// some system header file is included, it may be too late. - -#if !defined (_BSD_SOURCE) -#define _BSD_SOURCE 1 -#define OCTAVE_UNDEFINE_BSD_SOURCE -#endif - -#if !defined (_XOPEN_SOURCE) -#define _XOPEN_SOURCE 1 -#define OCTAVE_UNDEFINE_XOPEN_SOURCE -#endif - -#endif - #include <climits> #include <cmath> @@ -65,18 +38,6 @@ #include "lo-utils.h" #include "oct-time.h" -#if defined (OCTAVE_UNDEFINE_BSD_SOURCE) -#undef _BSD_SOURCE -#endif - -#if defined (OCTAVE_UNDEFINE_XOPEN_SOURCE) -#undef _XOPEN_SOURCE -#endif - -#if !defined (HAVE_STRPTIME) -extern "C" char *strptime (const char *buf, const char *format, struct tm *tm); -#endif - octave_time::octave_time (const octave_base_tm& tm) { struct tm t; @@ -286,7 +247,7 @@ char *p = strsave (str.c_str ()); - char *q = strptime (p, fmt.c_str (), &t); + char *q = oct_strptime (p, fmt.c_str (), &t); nchars = p - q;