Mercurial > hg > octave-lyh
diff liboctave/oct-time.cc @ 3465:996bb7ea4507
[project @ 2000-01-21 07:48:25 by jwe]
author | jwe |
---|---|
date | Fri, 21 Jan 2000 07:51:06 +0000 |
parents | ff13d5dec62d |
children | c800b7fb7d64 |
line wrap: on
line diff
--- a/liboctave/oct-time.cc +++ b/liboctave/oct-time.cc @@ -29,6 +29,7 @@ #include "lo-error.h" #include "lo-utils.h" +#define __USE_XOPEN #include "oct-time.h" octave_time::octave_time (const octave_base_tm& tm) @@ -218,6 +219,41 @@ octave_base_tm::init (gmtime (&t)); } +void +octave_strptime::init (const string& str, const string& fmt) +{ + struct tm t; + + t.tm_sec = 0; + t.tm_min = 0; + t.tm_hour = 0; + t.tm_mday = 0; + t.tm_mon = 0; + t.tm_year = 0; + t.tm_wday = 0; + t.tm_yday = 0; + t.tm_isdst = 0; + +#if defined (HAVE_TM_ZONE) + char *ps = strsave (""); + t.tm_zone = ps; +#endif + + char *p = strsave (str.c_str ()); + + char *q = strptime (p, fmt.c_str (), &t); + + nchars = p - q; + + delete [] p; + + octave_base_tm::init (&t); + +#if defined (HAVE_TM_ZONE) + delete ps; +#endif +} + /* ;;; Local Variables: *** ;;; mode: C++ ***