32 #include <sys/types.h>
44 : ot_unix_time (), ot_usec ()
50 t.tm_hour = tm.
hour ();
51 t.tm_mday = tm.
mday ();
53 t.tm_year = tm.
year ();
54 t.tm_wday = tm.
wday ();
55 t.tm_yday = tm.
yday ();
56 t.tm_isdst = tm.
isdst ();
58 #if defined (HAVE_STRUCT_TM_GMTOFF)
59 t.tm_gmtoff = tm.
gmtoff ();
62 #if defined (HAVE_STRUCT_TM_TM_ZONE)
63 std::string s = tm.
zone ();
64 char *ps =
strsave (s.c_str ());
70 #if defined (HAVE_STRUCT_TM_TM_ZONE)
88 gnulib::gettimeofday (&tp, 0);
107 #define DEFINE_SET_FIELD_FCN(type, f, lo, hi) \
109 octave_base_tm::f (type v) \
116 #define DEFINE_SET_INT_FIELD_FCN(f, lo, hi) \
117 DEFINE_SET_FIELD_FCN (int, f, lo, hi)
139 #if !defined STRFTIME_BUF_INITIAL_SIZE
140 #define STRFTIME_BUF_INITIAL_SIZE 128
162 #if defined (HAVE_STRUCT_TM_GMTOFF)
166 #if defined (HAVE_STRUCT_TM_TM_ZONE)
171 const char *fmt_str = fmt.c_str ();
175 size_t chars_written = 0;
177 while (chars_written == 0)
180 buf =
new char [bufsize];
183 chars_written = nstrftime (buf, bufsize, fmt_str, &t, 0, 0);
188 #if defined (HAVE_STRUCT_TM_TM_ZONE)
206 struct tm *t =
static_cast<struct tm*
> (p);
218 #if defined (HAVE_STRUCT_TM_GMTOFF)
222 #if defined (HAVE_STRUCT_TM_TM_ZONE)
225 #elif defined (HAVE_TZNAME)
226 if (t->tm_isdst == 0 || t->tm_isdst == 1)
266 #if defined (HAVE_STRUCT_TM_GMTOFF)
270 #if defined (HAVE_STRUCT_TM_TM_ZONE)
275 const char *p = str.c_str ();
277 char *q = gnulib::strptime (p, fmt.c_str (), &t);
281 if (t.tm_mday != 0 && t.tm_mon >= 0
301 #if defined (HAVE_STRUCT_TM_TM_ZONE)
void init(const octave_time &ot)
std::string ctime(void) const
#define DEFINE_SET_INT_FIELD_FCN(f, lo, hi)
std::string strftime(const std::string &fmt) const
std::string zone(void) const
void init(const std::string &str, const std::string &fmt)
static char * strsave(const char *s)
void init(const octave_time &ot)
time_t unix_time(void) const
charNDArray max(char d, const charNDArray &m)
#define DEFINE_SET_FIELD_FCN(type, f, lo, hi)
#define STRFTIME_BUF_INITIAL_SIZE
charNDArray min(char d, const charNDArray &m)