diff libinterp/octave-value/ov-usr-fcn.h @ 30826:243b51ec9ff0 stable

Remove `time_t` from API (bug #61821). The bit-width of `time_t` might change depending on compile time switches. That can cause a mismatch between class declarations in public headers and the actual alignment of the compiled classes. Avoid that problem by not using `time_t` in (public) headers. * build-aux/mk-octave-config-h.sh, oct-conf-post.in.h: Define OCTAVE_TIME_T to `int64_t`. The type of `time_t` is not defined in the C/C++ standards. However in all(?) implementations, it's either a signed 32-bit or a signed 64-bit integer. Use a signed 64-bit integer for storing those values in Octave classes. * other files: Use OCTAVE_TIME_T instead of `time_t`. Don't include <ctime> in files where it's not needed.
author Markus Mützel <markus.muetzel@gmx.de>
date Sat, 26 Feb 2022 13:46:48 +0100
parents 796f54d4ddbf
children c9788d7f6e65
line wrap: on
line diff
--- a/libinterp/octave-value/ov-usr-fcn.h	Thu Mar 10 18:58:29 2022 +0100
+++ b/libinterp/octave-value/ov-usr-fcn.h	Sat Feb 26 13:46:48 2022 +0100
@@ -28,8 +28,6 @@
 
 #include "octave-config.h"
 
-#include <ctime>
-
 #include <string>
 
 #include "comment-list.h"
@@ -64,8 +62,8 @@
                     octave::tree_statement_list *cmds = nullptr,
                     const std::string& ds = "")
     : octave_function (nm, ds), m_scope (scope), m_file_name (fnm),
-      m_t_parsed (static_cast<time_t> (0)),
-      m_t_checked (static_cast<time_t> (0)),
+      m_t_parsed (static_cast<OCTAVE_TIME_T> (0)),
+      m_t_checked (static_cast<OCTAVE_TIME_T> (0)),
       m_file_info (nullptr), m_cmd_list (cmds)
   {
     if (m_scope)