Mercurial > jwe > octave
changeset 22062:d18aad835ad6
provide wrapper for gnulib mktime function
* time-wrappers.h, time-wrappers.c (octave_mktime_wrapper):
New function.
* oct-time.cc: Use it.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 07 Jul 2016 10:28:31 -0400 |
parents | 737b1d9d7ee3 |
children | 55c20a3e3e59 |
files | liboctave/system/oct-time.cc liboctave/wrappers/time-wrappers.c liboctave/wrappers/time-wrappers.h |
diffstat | 3 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/system/oct-time.cc Thu Jul 07 08:42:44 2016 -0400 +++ b/liboctave/system/oct-time.cc Thu Jul 07 10:28:31 2016 -0400 @@ -73,7 +73,7 @@ t.tm_zone = ps; #endif - ot_unix_time = std::mktime (&t); + ot_unix_time = octave_mktime_wrapper (&t); #if defined (HAVE_STRUCT_TM_TM_ZONE) delete [] ps; @@ -286,7 +286,7 @@ && t.tm_year != std::numeric_limits<int>::min ()) { t.tm_isdst = -1; - std::mktime (&t); + octave_mktime_wrapper (&t); } if (t.tm_mon < 0)
--- a/liboctave/wrappers/time-wrappers.c Thu Jul 07 08:42:44 2016 -0400 +++ b/liboctave/wrappers/time-wrappers.c Thu Jul 07 10:28:31 2016 -0400 @@ -146,3 +146,9 @@ return status; } + +time_t +octave_mktime_wrapper (struct tm *tp) +{ + return mktime (tp); +}
--- a/liboctave/wrappers/time-wrappers.h Thu Jul 07 08:42:44 2016 -0400 +++ b/liboctave/wrappers/time-wrappers.h Thu Jul 07 10:28:31 2016 -0400 @@ -48,6 +48,9 @@ long *msgsnd, long *msgrcv, long *nsignals, long *nvcsw, long *nivcsw); +extern time_t +octave_mktime_wrapper (struct tm *tp); + #if defined __cplusplus } #endif