changeset 21730:30c53770f47e

use namespace for system time classes * oct-time.h, oct-time.cc: Put time classes in octave::sys namespace. Change all uses. (octave_time, octave_base_tm, octave_localtime, octave_gmtime, octave_strptime): Now deprecated typedefs for corresponding classes in octave::sys namespace.
author John W. Eaton <jwe@octave.org>
date Wed, 18 May 2016 15:23:05 -0400
parents 815b2f500fab
children 3dfec4c1eb8b
files libinterp/corefcn/__magick_read__.cc libinterp/corefcn/data.cc libinterp/corefcn/dirfns.cc libinterp/corefcn/dirfns.h libinterp/corefcn/input.cc libinterp/corefcn/input.h libinterp/corefcn/load-path.cc libinterp/corefcn/load-path.h libinterp/corefcn/load-save.cc libinterp/corefcn/oct-hist.cc libinterp/corefcn/profiler.cc libinterp/corefcn/symtab.cc libinterp/corefcn/time.cc libinterp/octave-value/ov-dld-fcn.cc libinterp/octave-value/ov-dld-fcn.h libinterp/octave-value/ov-fcn.h libinterp/octave-value/ov-mex-fcn.cc libinterp/octave-value/ov-mex-fcn.h libinterp/octave-value/ov-usr-fcn.h libinterp/octave-value/ov.cc libinterp/octave-value/ov.h libinterp/parse-tree/oct-parse.in.yy liboctave/numeric/oct-rand.cc liboctave/system/file-stat.cc liboctave/system/file-stat.h liboctave/system/oct-time.cc liboctave/system/oct-time.h liboctave/util/cmd-edit.cc liboctave/util/oct-shlib.h
diffstat 29 files changed, 633 insertions(+), 598 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/__magick_read__.cc	Wed May 18 13:11:15 2016 -0400
+++ b/libinterp/corefcn/__magick_read__.cc	Wed May 18 15:23:05 2016 -0400
@@ -1902,7 +1902,7 @@
     error ("imfinfo: error reading '%s': %s", filename.c_str (),
            fs.error ().c_str ());
 
-  const octave_localtime mtime (fs.mtime ());
+  const octave::sys::localtime mtime (fs.mtime ());
   const std::string filetime = mtime.strftime ("%e-%b-%Y %H:%M:%S");
   template_info.setfield ("Filename",    octave_value (filename));
   template_info.setfield ("FileModDate", octave_value (filetime));
--- a/libinterp/corefcn/data.cc	Wed May 18 13:11:15 2016 -0400
+++ b/libinterp/corefcn/data.cc	Wed May 18 15:23:05 2016 -0400
@@ -6250,7 +6250,7 @@
     warning ("tic: ignoring extra arguments");
 
   octave_value retval;
-  octave_time now;
+  octave::sys::time now;
   double tmp = now.double_value ();
 
   if (nargout > 0)
@@ -6300,7 +6300,7 @@
   if (start_time < 0)
     error ("toc called before timer set");
 
-  octave_time now;
+  octave::sys::time now;
 
   double etime = now.double_value () - start_time;
 
--- a/libinterp/corefcn/dirfns.cc	Wed May 18 13:11:15 2016 -0400
+++ b/libinterp/corefcn/dirfns.cc	Wed May 18 15:23:05 2016 -0400
@@ -66,7 +66,7 @@
 static bool Vconfirm_recursive_rmdir = true;
 
 // The time we last time we changed directories.
-octave_time Vlast_chdir_time = 0.0;
+octave::sys::time Vlast_chdir_time = 0.0;
 
 static int
 octave_change_to_directory (const std::string& newdir)
--- a/libinterp/corefcn/dirfns.h	Wed May 18 13:11:15 2016 -0400
+++ b/libinterp/corefcn/dirfns.h	Wed May 18 15:23:05 2016 -0400
@@ -32,6 +32,6 @@
 #include "oct-time.h"
 
 // The time we last time we changed directories.
-extern octave_time Vlast_chdir_time;
+extern octave::sys::time Vlast_chdir_time;
 
 #endif
--- a/libinterp/corefcn/input.cc	Wed May 18 13:11:15 2016 -0400
+++ b/libinterp/corefcn/input.cc	Wed May 18 15:23:05 2016 -0400
@@ -94,7 +94,7 @@
 int Vecho_executing_commands = ECHO_OFF;
 
 // The time we last printed a prompt.
-octave_time Vlast_prompt_time = 0.0;
+octave::sys::time Vlast_prompt_time = 0.0;
 
 // Character to append after successful command-line completion attempts.
 static char Vcompletion_append_char = ' ';
--- a/libinterp/corefcn/input.h	Wed May 18 13:11:15 2016 -0400
+++ b/libinterp/corefcn/input.h	Wed May 18 15:23:05 2016 -0400
@@ -82,7 +82,7 @@
 
 extern int Vecho_executing_commands;
 
-extern octave_time Vlast_prompt_time;
+extern octave::sys::time Vlast_prompt_time;
 
 class
 octave_base_reader
--- a/libinterp/corefcn/load-path.cc	Wed May 18 13:11:15 2016 -0400
+++ b/libinterp/corefcn/load-path.cc	Wed May 18 15:23:05 2016 -0400
@@ -135,7 +135,7 @@
 {
   is_relative = ! octave_env::absolute_pathname (dir_name);
 
-  dir_time_last_checked = octave_time (static_cast<time_t> (0));
+  dir_time_last_checked = octave::sys::time (static_cast<time_t> (0));
 
   file_stat fs (dir_name);
 
@@ -145,7 +145,7 @@
       package_dir_map.clear ();
 
       dir_mtime = fs.mtime ();
-      dir_time_last_checked = octave_time ();
+      dir_time_last_checked = octave::sys::time ();
 
       get_file_list (dir_name);
 
--- a/libinterp/corefcn/load-path.h	Wed May 18 13:11:15 2016 -0400
+++ b/libinterp/corefcn/load-path.h	Wed May 18 15:23:05 2016 -0400
@@ -394,8 +394,8 @@
     std::string dir_name;
     std::string abs_dir_name;
     bool is_relative;
-    octave_time dir_mtime;
-    octave_time dir_time_last_checked;
+    octave::sys::time dir_mtime;
+    octave::sys::time dir_time_last_checked;
     string_vector all_files;
     string_vector fcn_files;
     fcn_file_map_type private_file_map;
--- a/libinterp/corefcn/load-save.cc	Wed May 18 13:11:15 2016 -0400
+++ b/libinterp/corefcn/load-save.cc	Wed May 18 15:23:05 2016 -0400
@@ -1178,7 +1178,7 @@
         char const * versionmagic;
         int16_t number = *(reinterpret_cast<const int16_t *>("\x00\x01"));
         char headertext[128];
-        octave_gmtime now;
+        octave::sys::gmtime now;
 
         // ISO 8601 format date
         const char *matlab_format = "MATLAB 5.0 MAT-file, written by Octave "
@@ -1212,7 +1212,7 @@
 #endif
     case LS_TEXT:
       {
-        octave_localtime now;
+        octave::sys::localtime now;
 
         std::string comment_string = now.strftime (Vsave_header_format_string);
 
--- a/libinterp/corefcn/oct-hist.cc	Wed May 18 13:11:15 2016 -0400
+++ b/libinterp/corefcn/oct-hist.cc	Wed May 18 15:23:05 2016 -0400
@@ -544,7 +544,7 @@
 void
 octave_history_write_timestamp (void)
 {
-  octave_localtime now;
+  octave::sys::localtime now;
 
   std::string timestamp = now.strftime (Vhistory_timestamp_format_string);
 
--- a/libinterp/corefcn/profiler.cc	Wed May 18 13:11:15 2016 -0400
+++ b/libinterp/corefcn/profiler.cc	Wed May 18 15:23:05 2016 -0400
@@ -370,7 +370,7 @@
 double
 profile_data_accumulator::query_time (void) const
 {
-  octave_time now;
+  octave::sys::time now;
 
   // FIXME: is this volatile declaration really needed?
   // See bug #34210 for additional details.
--- a/libinterp/corefcn/symtab.cc	Wed May 18 13:11:15 2016 -0400
+++ b/libinterp/corefcn/symtab.cc	Wed May 18 15:23:05 2016 -0400
@@ -228,7 +228,7 @@
 
           if (! ff.empty ())
             {
-              octave_time tc = fcn->time_checked ();
+              octave::sys::time tc = fcn->time_checked ();
 
               bool relative = check_relative && fcn->is_relative ();
 
@@ -326,10 +326,10 @@
                     {
                       // Same file.  If it is out of date, then reload it.
 
-                      octave_time ottp = fcn->time_parsed ();
+                      octave::sys::time ottp = fcn->time_parsed ();
                       time_t tp = ottp.unix_time ();
 
-                      fcn->mark_fcn_file_up_to_date (octave_time ());
+                      fcn->mark_fcn_file_up_to_date (octave::sys::time ());
 
                       if (! (Vignore_function_time_stamp == 2
                              || (Vignore_function_time_stamp
--- a/libinterp/corefcn/time.cc	Wed May 18 13:11:15 2016 -0400
+++ b/libinterp/corefcn/time.cc	Wed May 18 15:23:05 2016 -0400
@@ -36,7 +36,7 @@
 // Date and time functions.
 
 static octave_scalar_map
-mk_tm_map (const octave_base_tm& t)
+mk_tm_map (const octave::sys::base_tm& t)
 {
   octave_scalar_map m;
 
@@ -82,10 +82,10 @@
   return retval;
 }
 
-static octave_base_tm
+static octave::sys::base_tm
 extract_tm (const octave_scalar_map& m, const char *who)
 {
-  octave_base_tm tm;
+  octave::sys::base_tm tm;
 
   tm.usec (intfield (m, "usec", who));
   tm.sec (intfield (m, "sec", who));
@@ -117,7 +117,7 @@
   if (args.length () != 0)
     print_usage ();
 
-  return ovl (octave_time ());
+  return ovl (octave::sys::time ());
 }
 
 /*
@@ -161,7 +161,7 @@
 
   double tmp = args(0).double_value ();
 
-  return ovl (mk_tm_map (octave_gmtime (tmp)));
+  return ovl (mk_tm_map (octave::sys::gmtime (tmp)));
 }
 
 /*
@@ -216,7 +216,7 @@
 
   double tmp = args(0).double_value ();
 
-  return ovl (mk_tm_map (octave_localtime (tmp)));
+  return ovl (mk_tm_map (octave::sys::localtime (tmp)));
 }
 
 /*
@@ -260,9 +260,9 @@
 
   octave_scalar_map map = args(0).xscalar_map_value ("mktime: TM_STRUCT argument must be a structure");
 
-  octave_base_tm tm = extract_tm (map, "mktime");
+  octave::sys::base_tm tm = extract_tm (map, "mktime");
 
-  return ovl (octave_time (tm));
+  return ovl (octave::sys::time (tm));
 }
 
 /*
@@ -447,7 +447,7 @@
 
   octave_scalar_map map = args(1).xscalar_map_value ("strftime: TM_STRUCT must be a structure");
 
-  octave_base_tm tm = extract_tm (map, "strftime");
+  octave::sys::base_tm tm = extract_tm (map, "strftime");
 
   return ovl (tm.strftime (fmt));
 }
@@ -484,7 +484,7 @@
 
   std::string fmt = args(1).xstring_value ("strptime: FMT must be a string");
 
-  octave_strptime t (str, fmt);
+  octave::sys::strptime t (str, fmt);
 
   return ovl (mk_tm_map (t), t.characters_converted ());
 }
--- a/libinterp/octave-value/ov-dld-fcn.cc	Wed May 18 13:11:15 2016 -0400
+++ b/libinterp/octave-value/ov-dld-fcn.cc	Wed May 18 15:23:05 2016 -0400
@@ -64,7 +64,7 @@
   return sh_lib.file_name ();
 }
 
-octave_time
+octave::sys::time
 octave_dld_function::time_parsed (void) const
 {
   return sh_lib.time_loaded ();
--- a/libinterp/octave-value/ov-dld-fcn.h	Wed May 18 13:11:15 2016 -0400
+++ b/libinterp/octave-value/ov-dld-fcn.h	Wed May 18 15:23:05 2016 -0400
@@ -56,13 +56,13 @@
 
   ~octave_dld_function (void);
 
-  void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; }
+  void mark_fcn_file_up_to_date (const octave::sys::time& t) { t_checked = t; }
 
   std::string fcn_file_name (void) const;
 
-  octave_time time_parsed (void) const;
+  octave::sys::time time_parsed (void) const;
 
-  octave_time time_checked (void) const { return t_checked; }
+  octave::sys::time time_checked (void) const { return t_checked; }
 
   bool is_system_fcn_file (void) const { return system_fcn_file; }
 
@@ -84,7 +84,7 @@
 
   // The time the file was last checked to see if it needs to be
   // parsed again.
-  mutable octave_time t_checked;
+  mutable octave::sys::time t_checked;
 
   // True if this function came from a file that is considered to be a
   // system function.  This affects whether we check the time stamp
--- a/libinterp/octave-value/ov-fcn.h	Wed May 18 13:11:15 2016 -0400
+++ b/libinterp/octave-value/ov-fcn.h	Wed May 18 15:23:05 2016 -0400
@@ -72,15 +72,15 @@
 
   virtual symbol_table::scope_id parent_fcn_scope (void) const { return -1; }
 
-  virtual void mark_fcn_file_up_to_date (const octave_time&) { }
+  virtual void mark_fcn_file_up_to_date (const octave::sys::time&) { }
 
   virtual symbol_table::scope_id scope (void) { return -1; }
 
-  virtual octave_time time_parsed (void) const
-  { return octave_time (static_cast<time_t> (0)); }
+  virtual octave::sys::time time_parsed (void) const
+  { return octave::sys::time (static_cast<time_t> (0)); }
 
-  virtual octave_time time_checked (void) const
-  { return octave_time (static_cast<time_t> (0)); }
+  virtual octave::sys::time time_checked (void) const
+  { return octave::sys::time (static_cast<time_t> (0)); }
 
   virtual bool is_subfunction (void) const { return false; }
 
--- a/libinterp/octave-value/ov-mex-fcn.cc	Wed May 18 13:11:15 2016 -0400
+++ b/libinterp/octave-value/ov-mex-fcn.cc	Wed May 18 15:23:05 2016 -0400
@@ -70,7 +70,7 @@
   return sh_lib.file_name ();
 }
 
-octave_time
+octave::sys::time
 octave_mex_function::time_parsed (void) const
 {
   return sh_lib.time_loaded ();
--- a/libinterp/octave-value/ov-mex-fcn.h	Wed May 18 13:11:15 2016 -0400
+++ b/libinterp/octave-value/ov-mex-fcn.h	Wed May 18 15:23:05 2016 -0400
@@ -69,13 +69,13 @@
 
   const octave_function *function_value (bool = false) const { return this; }
 
-  void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; }
+  void mark_fcn_file_up_to_date (const octave::sys::time& t) { t_checked = t; }
 
   std::string fcn_file_name (void) const;
 
-  octave_time time_parsed (void) const;
+  octave::sys::time time_parsed (void) const;
 
-  octave_time time_checked (void) const { return t_checked; }
+  octave::sys::time time_checked (void) const { return t_checked; }
 
   bool is_system_fcn_file (void) const { return system_fcn_file; }
 
@@ -103,7 +103,7 @@
 
   // The time the file was last checked to see if it needs to be
   // parsed again.
-  mutable octave_time t_checked;
+  mutable octave::sys::time t_checked;
 
   // True if this function came from a file that is considered to be a
   // system function.  This affects whether we check the time stamp
--- a/libinterp/octave-value/ov-usr-fcn.h	Wed May 18 13:11:15 2016 -0400
+++ b/libinterp/octave-value/ov-usr-fcn.h	Wed May 18 15:23:05 2016 -0400
@@ -111,9 +111,9 @@
 
   void stash_fcn_file_name (const std::string& nm) { file_name = nm; }
 
-  void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; }
+  void mark_fcn_file_up_to_date (const octave::sys::time& t) { t_checked = t; }
 
-  void stash_fcn_file_time (const octave_time& t)
+  void stash_fcn_file_time (const octave::sys::time& t)
   {
     t_parsed = t;
     mark_fcn_file_up_to_date (t);
@@ -121,9 +121,9 @@
 
   std::string fcn_file_name (void) const { return file_name; }
 
-  octave_time time_parsed (void) const { return t_parsed; }
+  octave::sys::time time_parsed (void) const { return t_parsed; }
 
-  octave_time time_checked (void) const { return t_checked; }
+  octave::sys::time time_checked (void) const { return t_checked; }
 
   octave_value subsref (const std::string& type,
                         const std::list<octave_value_list>& idx)
@@ -152,11 +152,11 @@
   std::string file_name;
 
   // The time the file was parsed.
-  octave_time t_parsed;
+  octave::sys::time t_parsed;
 
   // The time the file was last checked to see if it needs to be
   // parsed again.
-  octave_time t_checked;
+  octave::sys::time t_checked;
 
   // Used to keep track of recursion depth.
   int call_depth;
@@ -231,9 +231,9 @@
 
   void stash_trailing_comment (octave_comment_list *tc) { trail_comm = tc; }
 
-  void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; }
+  void mark_fcn_file_up_to_date (const octave::sys::time& t) { t_checked = t; }
 
-  void stash_fcn_file_time (const octave_time& t)
+  void stash_fcn_file_time (const octave::sys::time& t)
   {
     t_parsed = t;
     mark_fcn_file_up_to_date (t);
@@ -249,9 +249,9 @@
 
   symbol_table::scope_id scope (void) { return local_scope; }
 
-  octave_time time_parsed (void) const { return t_parsed; }
+  octave::sys::time time_parsed (void) const { return t_parsed; }
 
-  octave_time time_checked (void) const { return t_checked; }
+  octave::sys::time time_checked (void) const { return t_checked; }
 
   void mark_as_system_fcn_file (void);
 
@@ -457,11 +457,11 @@
   std::list<std::string> subfcn_names;
 
   // The time the file was parsed.
-  octave_time t_parsed;
+  octave::sys::time t_parsed;
 
   // The time the file was last checked to see if it needs to be
   // parsed again.
-  octave_time t_checked;
+  octave::sys::time t_checked;
 
   // True if this function came from a file that is considered to be a
   // system function.  This affects whether we check the time stamp
--- a/libinterp/octave-value/ov.cc	Wed May 18 13:11:15 2016 -0400
+++ b/libinterp/octave-value/ov.cc	Wed May 18 15:23:05 2016 -0400
@@ -515,7 +515,7 @@
 }
 #endif
 
-octave_value::octave_value (octave_time t)
+octave_value::octave_value (octave::sys::time t)
   : rep (new octave_scalar (t.double_value ()))
 {
 }
--- a/libinterp/octave-value/ov.h	Wed May 18 13:11:15 2016 -0400
+++ b/libinterp/octave-value/ov.h	Wed May 18 15:23:05 2016 -0400
@@ -191,7 +191,7 @@
   octave_value (unsigned long long int i);
 #endif
 
-  octave_value (octave_time t);
+  octave_value (octave::sys::time t);
   octave_value (double d);
   octave_value (float d);
   octave_value (const Array<octave_value>& a, bool is_cs_list = false);
--- a/libinterp/parse-tree/oct-parse.in.yy	Wed May 18 13:11:15 2016 -0400
+++ b/libinterp/parse-tree/oct-parse.in.yy	Wed May 18 15:23:05 2016 -0400
@@ -3094,7 +3094,7 @@
 
   lexer.help_text = "";
 
-  octave_time now;
+  octave::sys::time now;
 
   script->stash_fcn_file_time (now);
 
@@ -3176,7 +3176,7 @@
 
   if (lexer.reading_fcn_file || lexer.reading_classdef_file || autoloading)
     {
-      octave_time now;
+      octave::sys::time now;
 
       fcn->stash_fcn_file_name (lexer.fcn_file_full_name);
       fcn->stash_fcn_file_time (now);
--- a/liboctave/numeric/oct-rand.cc	Wed May 18 13:11:15 2016 -0400
+++ b/liboctave/numeric/oct-rand.cc	Wed May 18 15:23:05 2016 -0400
@@ -572,7 +572,7 @@
 void
 octave_rand::initialize_ranlib_generators (void)
 {
-  octave_localtime tm;
+  octave::sys::localtime tm;
   int stored_distribution = current_distribution;
   F77_FUNC (setcgn, SETCGN) (uniform_dist);
 
--- a/liboctave/system/file-stat.cc	Wed May 18 13:11:15 2016 -0400
+++ b/liboctave/system/file-stat.cc	Wed May 18 15:23:05 2016 -0400
@@ -166,7 +166,7 @@
 // and -1 for any error.
 
 int
-base_file_stat::is_newer (const std::string& file, const octave_time& time)
+base_file_stat::is_newer (const std::string& file, const octave::sys::time& time)
 {
   file_stat fs (file);
 
--- a/liboctave/system/file-stat.h	Wed May 18 13:11:15 2016 -0400
+++ b/liboctave/system/file-stat.h	Wed May 18 15:23:05 2016 -0400
@@ -79,9 +79,9 @@
   // The minimum difference in file time stamp values.
   // FIXME: This value should come from the filesystem itself.
   //        How can we get that info?
-  octave_time time_resolution (void) const
+  octave::sys::time time_resolution (void) const
   {
-    static octave_time resolution (1.0);
+    static octave::sys::time resolution (1.0);
     return resolution;
   }
 
@@ -116,9 +116,9 @@
 
   off_t size (void) const { return fs_size; }
 
-  octave_time atime (void) const { return fs_atime; }
-  octave_time mtime (void) const { return fs_mtime; }
-  octave_time ctime (void) const { return fs_ctime; }
+  octave::sys::time atime (void) const { return fs_atime; }
+  octave::sys::time mtime (void) const { return fs_mtime; }
+  octave::sys::time ctime (void) const { return fs_ctime; }
 
   dev_t rdev (void) const { return fs_rdev; }
 
@@ -138,11 +138,11 @@
   std::string error (void) const { return ok () ? "" : errmsg; }
 
   // Has the file referenced by this object been modified since TIME?
-  bool is_newer (const octave_time& time) const { return fs_mtime > time; }
+  bool is_newer (const octave::sys::time& time) const { return fs_mtime > time; }
 
   // It's nice to be able to hide the file_stat object if we don't
   // really care about it.
-  static int is_newer (const std::string&, const octave_time&);
+  static int is_newer (const std::string&, const octave::sys::time&);
 
 protected:
 
@@ -179,13 +179,13 @@
   off_t fs_size;
 
   // time of last access
-  octave_time fs_atime;
+  octave::sys::time fs_atime;
 
   // time of last modification
-  octave_time fs_mtime;
+  octave::sys::time fs_mtime;
 
   // time of last file status change
-  octave_time fs_ctime;
+  octave::sys::time fs_ctime;
 
   // device number for special files
   dev_t fs_rdev;
--- a/liboctave/system/oct-time.cc	Wed May 18 13:11:15 2016 -0400
+++ b/liboctave/system/oct-time.cc	Wed May 18 15:23:05 2016 -0400
@@ -40,272 +40,280 @@
 #include "oct-locbuf.h"
 #include "oct-time.h"
 
-octave_time::octave_time (double d)
-  : ot_unix_time (static_cast<time_t> (d)), ot_usec (0)
-{
-  double ip;
-  ot_usec = static_cast<int> (std::modf (d, &ip) * 1e6);
-}
-
-octave_time::octave_time (const octave_base_tm& tm)
-  : ot_unix_time (), ot_usec ()
+namespace
+octave
 {
-  struct tm t;
+  namespace
+  sys
+  {
+    time::time (double d)
+      : ot_unix_time (static_cast<time_t> (d)), ot_usec (0)
+    {
+      double ip;
+      ot_usec = static_cast<int> (std::modf (d, &ip) * 1e6);
+    }
 
-  t.tm_sec = tm.sec ();
-  t.tm_min = tm.min ();
-  t.tm_hour = tm.hour ();
-  t.tm_mday = tm.mday ();
-  t.tm_mon = tm.mon ();
-  t.tm_year = tm.year ();
-  t.tm_wday = tm.wday ();
-  t.tm_yday = tm.yday ();
-  t.tm_isdst = tm.isdst ();
+    time::time (const base_tm& tm)
+      : ot_unix_time (), ot_usec ()
+    {
+      struct ::tm t;
+
+      t.tm_sec = tm.sec ();
+      t.tm_min = tm.min ();
+      t.tm_hour = tm.hour ();
+      t.tm_mday = tm.mday ();
+      t.tm_mon = tm.mon ();
+      t.tm_year = tm.year ();
+      t.tm_wday = tm.wday ();
+      t.tm_yday = tm.yday ();
+      t.tm_isdst = tm.isdst ();
 
 #if defined (HAVE_TM_GMTOFF)
-  t.tm_gmtoff = tm.gmtoff ();
+      t.tm_gmtoff = tm.gmtoff ();
 #endif
 
 #if defined (HAVE_STRUCT_TM_TM_ZONE)
-  std::string s = tm.zone ();
-  char *ps = strsave (s.c_str ());
-  t.tm_zone = ps;
+      std::string s = tm.zone ();
+      char *ps = strsave (s.c_str ());
+      t.tm_zone = ps;
 #endif
 
-  ot_unix_time = gnulib::mktime (&t);
+      ot_unix_time = gnulib::mktime (&t);
 
 #if defined (HAVE_STRUCT_TM_TM_ZONE)
-  delete [] ps;
+      delete [] ps;
 #endif
 
-  ot_usec = tm.usec ();
-}
+      ot_usec = tm.usec ();
+    }
 
-std::string
-octave_time::ctime (void) const
-{
-  return octave_localtime (*this) . asctime ();
-}
+    std::string
+    time::ctime (void) const
+    {
+      return localtime (*this) . asctime ();
+    }
 
-void
-octave_time::stamp (void)
-{
-  struct timeval tp;
+    void
+    time::stamp (void)
+    {
+      struct ::timeval tp;
 
-  gnulib::gettimeofday (&tp, 0);
+      gnulib::gettimeofday (&tp, 0);
 
-  ot_unix_time = tp.tv_sec;
-  ot_usec = tp.tv_usec;
-}
+      ot_unix_time = tp.tv_sec;
+      ot_usec = tp.tv_usec;
+    }
 
-// From the mktime() manual page:
-//
-//     The mktime() function converts a broken-down time structure,
-//     expressed as local time, to calendar time representation.
-//
-//     <snip>
-//
-//     If structure members are outside their legal interval, they
-//     will be normalized (so that, e.g., 40 October is changed into
-//     9 November).
-//
-// So, we no longer check limits here.
+    // From the mktime() manual page:
+    //
+    //     The mktime() function converts a broken-down time structure,
+    //     expressed as local time, to calendar time representation.
+    //
+    //     <snip>
+    //
+    //     If structure members are outside their legal interval, they
+    //     will be normalized (so that, e.g., 40 October is changed into
+    //     9 November).
+    //
+    // So, we no longer check limits here.
 
-#define DEFINE_SET_FIELD_FCN(type, f, lo, hi) \
-  octave_base_tm& \
-  octave_base_tm::f (type v) \
-  { \
-    tm_ ## f = v; \
- \
-    return *this; \
-  }
+#define DEFINE_SET_FIELD_FCN(type, f, lo, hi)   \
+    base_tm&                             \
+    base_tm::f (type v)                  \
+    {                                           \
+      m_ ## f = v;                             \
+                                                \
+      return *this;                             \
+    }
 
-#define DEFINE_SET_INT_FIELD_FCN(f, lo, hi) \
-  DEFINE_SET_FIELD_FCN (int, f, lo, hi)
+#define DEFINE_SET_INT_FIELD_FCN(f, lo, hi)     \
+    DEFINE_SET_FIELD_FCN (int, f, lo, hi)
 
-DEFINE_SET_INT_FIELD_FCN (usec, 0, 1000000)
-DEFINE_SET_INT_FIELD_FCN (sec, 0, 61)
-DEFINE_SET_INT_FIELD_FCN (min, 0, 59)
-DEFINE_SET_INT_FIELD_FCN (hour, 0, 23)
-DEFINE_SET_INT_FIELD_FCN (mday, 1, 31)
-DEFINE_SET_INT_FIELD_FCN (mon, 0, 11)
-DEFINE_SET_INT_FIELD_FCN (year, std::numeric_limits<int>::min (),
-                          std::numeric_limitd<int>::max ())
-DEFINE_SET_INT_FIELD_FCN (wday, 0, 6)
-DEFINE_SET_INT_FIELD_FCN (yday, 0, 365)
-DEFINE_SET_INT_FIELD_FCN (isdst, 0, 1)
-DEFINE_SET_FIELD_FCN (long, gmtoff, -86400, 0)
+    DEFINE_SET_INT_FIELD_FCN (usec, 0, 1000000)
+    DEFINE_SET_INT_FIELD_FCN (sec, 0, 61)
+    DEFINE_SET_INT_FIELD_FCN (min, 0, 59)
+    DEFINE_SET_INT_FIELD_FCN (hour, 0, 23)
+    DEFINE_SET_INT_FIELD_FCN (mday, 1, 31)
+    DEFINE_SET_INT_FIELD_FCN (mon, 0, 11)
+    DEFINE_SET_INT_FIELD_FCN (year, std::numeric_limits<int>::min (),
+                              std::numeric_limitd<int>::max ())
+    DEFINE_SET_INT_FIELD_FCN (wday, 0, 6)
+    DEFINE_SET_INT_FIELD_FCN (yday, 0, 365)
+    DEFINE_SET_INT_FIELD_FCN (isdst, 0, 1)
+    DEFINE_SET_FIELD_FCN (long, gmtoff, -86400, 0)
 
-octave_base_tm&
-octave_base_tm::zone (const std::string& s)
-{
-  tm_zone = s;
-  return *this;
-}
+    base_tm&
+    base_tm::zone (const std::string& s)
+    {
+      m_zone = s;
+      return *this;
+    }
 
 #if ! defined STRFTIME_BUF_INITIAL_SIZE
 #  define STRFTIME_BUF_INITIAL_SIZE 128
 #endif
 
-std::string
-octave_base_tm::strftime (const std::string& fmt) const
-{
-  std::string retval;
+    std::string
+    base_tm::strftime (const std::string& fmt) const
+    {
+      std::string retval;
 
-  if (! fmt.empty ())
-    {
-      struct tm t;
+      if (! fmt.empty ())
+        {
+          struct ::tm t;
 
-      t.tm_sec = tm_sec;
-      t.tm_min = tm_min;
-      t.tm_hour = tm_hour;
-      t.tm_mday = tm_mday;
-      t.tm_mon = tm_mon;
-      t.tm_year = tm_year;
-      t.tm_wday = tm_wday;
-      t.tm_yday = tm_yday;
-      t.tm_isdst = tm_isdst;
+          t.tm_sec = m_sec;
+          t.tm_min = m_min;
+          t.tm_hour = m_hour;
+          t.tm_mday = m_mday;
+          t.tm_mon = m_mon;
+          t.tm_year = m_year;
+          t.tm_wday = m_wday;
+          t.tm_yday = m_yday;
+          t.tm_isdst = m_isdst;
 
 #if defined (HAVE_TM_GMTOFF)
-      t.tm_gmtoff = tm_gmtoff;
+          t.tm_gmtoff = m_gmtoff;
 #endif
 
 #if defined (HAVE_STRUCT_TM_TM_ZONE)
-      char *ps = strsave (tm_zone.c_str ());
+          char *ps = strsave (m_zone.c_str ());
+          t.tm_zone = ps;
+#endif
+
+          const char *fmt_str = fmt.c_str ();
+
+          char *buf = 0;
+          size_t bufsize = STRFTIME_BUF_INITIAL_SIZE;
+          size_t chars_written = 0;
+
+          while (chars_written == 0)
+            {
+              delete [] buf;
+              buf = new char [bufsize];
+              buf[0] = '\0';
+
+              chars_written = nstrftime (buf, bufsize, fmt_str, &t, 0, 0);
+
+              bufsize *= 2;
+            }
+
+#if defined (HAVE_STRUCT_TM_TM_ZONE)
+          delete [] ps;
+#endif
+
+          retval = buf;
+
+          delete [] buf;
+        }
+
+      return retval;
+    }
+
+    void
+    base_tm::init (void *p)
+    {
+      if (! p)
+        return;
+
+      struct ::tm *t = static_cast<struct ::tm*> (p);
+
+      m_sec = t->tm_sec;
+      m_min = t->tm_min;
+      m_hour = t->tm_hour;
+      m_mday = t->tm_mday;
+      m_mon = t->tm_mon;
+      m_year = t->tm_year;
+      m_wday = t->tm_wday;
+      m_yday = t->tm_yday;
+      m_isdst = t->tm_isdst;
+
+#if defined (HAVE_TM_GMTOFF)
+      m_gmtoff = t->tm_gmtoff;
+#endif
+
+#if defined (HAVE_STRUCT_TM_TM_ZONE)
+      if (t->tm_zone)
+        m_zone = t->tm_zone;
+#elif defined (HAVE_TZNAME)
+      if (t->tm_isdst == 0 || t->tm_isdst == 1)
+        m_zone = tzname[t->tm_isdst];
+#endif
+    }
+
+    void
+    localtime::init (const time& ot)
+    {
+      m_usec = ot.usec ();
+
+      time_t t = ot.unix_time ();
+
+      base_tm::init (gnulib::localtime (&t));
+    }
+
+    void
+    gmtime::init (const time& ot)
+    {
+      m_usec = ot.usec ();
+
+      time_t t = ot.unix_time ();
+
+      base_tm::init (gnulib::gmtime (&t));
+    }
+
+    void
+    strptime::init (const std::string& str, const std::string& fmt)
+    {
+      struct ::tm t;
+
+      t.tm_sec = 0;
+      t.tm_min = 0;
+      t.tm_hour = 0;
+      t.tm_mday = 0;
+      t.tm_mon = -1;
+      t.tm_year = std::numeric_limits<int>::min ();
+      t.tm_wday = 0;
+      t.tm_yday = 0;
+      t.tm_isdst = 0;
+
+#if defined (HAVE_TM_GMTOFF)
+      t.tm_gmtoff = 0;
+#endif
+
+#if defined (HAVE_STRUCT_TM_TM_ZONE)
+      char *ps = strsave ("");
       t.tm_zone = ps;
 #endif
 
-      const char *fmt_str = fmt.c_str ();
+      const char *p = str.c_str ();
+
+      char *q = gnulib::strptime (p, fmt.c_str (), &t);
 
-      char *buf = 0;
-      size_t bufsize = STRFTIME_BUF_INITIAL_SIZE;
-      size_t chars_written = 0;
-
-      while (chars_written == 0)
+      // Fill in wday and yday, but only if mday is valid and the mon and year
+      // are filled in, avoiding issues with mktime and invalid dates.
+      if (t.tm_mday != 0 && t.tm_mon >= 0
+          && t.tm_year != std::numeric_limits<int>::min ())
         {
-          delete [] buf;
-          buf = new char [bufsize];
-          buf[0] = '\0';
+          t.tm_isdst = -1;
+          gnulib::mktime (&t);
+        }
+
+      if (t.tm_mon < 0)
+        t.tm_mon = 0;
 
-          chars_written = nstrftime (buf, bufsize, fmt_str, &t, 0, 0);
+      if (t.tm_year == std::numeric_limits<int>::min ())
+        t.tm_year = 0;
 
-          bufsize *= 2;
-        }
+      if (q)
+        nchars = q - p + 1;
+      else
+        nchars = 0;
+
+      base_tm::init (&t);
 
 #if defined (HAVE_STRUCT_TM_TM_ZONE)
       delete [] ps;
 #endif
-
-      retval = buf;
-
-      delete [] buf;
     }
-
-  return retval;
-}
-
-void
-octave_base_tm::init (void *p)
-{
-  if (! p)
-    return;
-
-  struct tm *t = static_cast<struct tm*> (p);
-
-  tm_sec = t->tm_sec;
-  tm_min = t->tm_min;
-  tm_hour = t->tm_hour;
-  tm_mday = t->tm_mday;
-  tm_mon = t->tm_mon;
-  tm_year = t->tm_year;
-  tm_wday = t->tm_wday;
-  tm_yday = t->tm_yday;
-  tm_isdst = t->tm_isdst;
-
-#if defined (HAVE_TM_GMTOFF)
-  tm_gmtoff = t->tm_gmtoff;
-#endif
-
-#if defined (HAVE_STRUCT_TM_TM_ZONE)
-  if (t->tm_zone)
-    tm_zone = t->tm_zone;
-#elif defined (HAVE_TZNAME)
-  if (t->tm_isdst == 0 || t->tm_isdst == 1)
-    tm_zone = tzname[t->tm_isdst];
-#endif
-}
-
-void
-octave_localtime::init (const octave_time& ot)
-{
-  tm_usec = ot.usec ();
-
-  time_t t = ot.unix_time ();
-
-  octave_base_tm::init (gnulib::localtime (&t));
+  }
 }
-
-void
-octave_gmtime::init (const octave_time& ot)
-{
-  tm_usec = ot.usec ();
-
-  time_t t = ot.unix_time ();
-
-  octave_base_tm::init (gnulib::gmtime (&t));
-}
-
-void
-octave_strptime::init (const std::string& str, const std::string& fmt)
-{
-  struct tm t;
-
-  t.tm_sec = 0;
-  t.tm_min = 0;
-  t.tm_hour = 0;
-  t.tm_mday = 0;
-  t.tm_mon = -1;
-  t.tm_year = std::numeric_limits<int>::min ();
-  t.tm_wday = 0;
-  t.tm_yday = 0;
-  t.tm_isdst = 0;
-
-#if defined (HAVE_TM_GMTOFF)
-  t.tm_gmtoff = 0;
-#endif
-
-#if defined (HAVE_STRUCT_TM_TM_ZONE)
-  char *ps = strsave ("");
-  t.tm_zone = ps;
-#endif
-
-  const char *p = str.c_str ();
-
-  char *q = gnulib::strptime (p, fmt.c_str (), &t);
-
-  // Fill in wday and yday, but only if mday is valid and the mon and year
-  // are filled in, avoiding issues with mktime and invalid dates.
-  if (t.tm_mday != 0 && t.tm_mon >= 0
-      && t.tm_year != std::numeric_limits<int>::min ())
-    {
-      t.tm_isdst = -1;
-      gnulib::mktime (&t);
-    }
-
-  if (t.tm_mon < 0)
-    t.tm_mon = 0;
-
-  if (t.tm_year == std::numeric_limits<int>::min ())
-    t.tm_year = 0;
-
-  if (q)
-    nchars = q - p + 1;
-  else
-    nchars = 0;
-
-  octave_base_tm::init (&t);
-
-#if defined (HAVE_STRUCT_TM_TM_ZONE)
-  delete [] ps;
-#endif
-}
--- a/liboctave/system/oct-time.h	Wed May 18 13:11:15 2016 -0400
+++ b/liboctave/system/oct-time.h	Wed May 18 15:23:05 2016 -0400
@@ -28,336 +28,363 @@
 #include <ctime>
 #include <string>
 
-class octave_base_tm;
-
-class
-OCTAVE_API
-octave_time
+namespace
+octave
 {
-public:
+  namespace
+  sys
+  {
+    class base_tm;
+
+    class
+    OCTAVE_API
+    time
+    {
+    public:
+
+      time (void)
+        : ot_unix_time (0), ot_usec (0) { stamp (); }
+
+      time (time_t t)
+        : ot_unix_time (t), ot_usec (0) { }
 
-  octave_time (void)
-    : ot_unix_time (0), ot_usec (0) { stamp (); }
+      time (time_t t, int us)
+        : ot_unix_time (t), ot_usec ()
+        {
+          int rem, extra;
 
-  octave_time (time_t t)
-    : ot_unix_time (t), ot_usec (0) { }
+          if (us >= 0)
+            {
+              rem = us % 1000000;
+              extra = (us - rem) / 1000000;
+            }
+          else
+            {
+              us = -us;
+              rem = us % 1000000;
+              extra = - (1 + (us - rem) / 1000000);
+              rem = 1000000 - us % 1000000;
+            }
 
-  octave_time (time_t t, int us)
-    : ot_unix_time (t), ot_usec ()
-  {
-    int rem, extra;
+          ot_usec = rem;
+          ot_unix_time += extra;
+        }
+
+      time (double d);
+
+      time (const base_tm& tm);
+
+      time (const time& ot)
+        : ot_unix_time (ot.ot_unix_time), ot_usec (ot.ot_usec) { }
+
+      time& operator = (const time& ot)
+        {
+          if (this != &ot)
+            {
+              ot_unix_time = ot.ot_unix_time;
+              ot_usec = ot.ot_usec;
+            }
 
-    if (us >= 0)
-      {
-        rem = us % 1000000;
-        extra = (us - rem) / 1000000;
-      }
-    else
-      {
-        us = -us;
-        rem = us % 1000000;
-        extra = - (1 + (us - rem) / 1000000);
-        rem = 1000000 - us % 1000000;
-      }
+          return *this;
+        }
+
+      ~time (void) { }
+
+      void stamp (void);
+
+      double double_value (void) const { return ot_unix_time + ot_usec / 1e6; }
+
+      time_t unix_time (void) const { return ot_unix_time; }
+
+      int usec (void) const { return ot_usec; }
+
+      std::string ctime (void) const;
+
+    private:
+
+      // Seconds since the epoch.
+      time_t ot_unix_time;
 
-    ot_usec = rem;
-    ot_unix_time += extra;
-  }
+      // Additional microseconds.
+      int ot_usec;
+    };
+
+    inline bool
+    operator == (const time& t1, const time& t2)
+    {
+      return (t1.unix_time () == t2.unix_time () && t1.usec () == t2.usec ());
+    }
+
+    inline bool
+    operator != (const time& t1, const time& t2)
+    {
+      return ! (t1 == t2);
+    }
 
-  octave_time (double d);
+    inline bool
+    operator < (const time& t1, const time& t2)
+    {
+      if (t1.unix_time () < t2.unix_time ())
+        return true;
+      else if (t1.unix_time () > t2.unix_time ())
+        return false;
+      else if (t1.usec () < t2.usec ())
+        return true;
+      else
+        return false;
+    }
 
-  octave_time (const octave_base_tm& tm);
-
-  octave_time (const octave_time& ot)
-    : ot_unix_time (ot.ot_unix_time), ot_usec (ot.ot_usec) { }
+    inline bool
+    operator <= (const time& t1, const time& t2)
+    {
+      return (t1 < t2 || t1 == t2);
+    }
 
-  octave_time& operator = (const octave_time& ot)
-  {
-    if (this != &ot)
-      {
-        ot_unix_time = ot.ot_unix_time;
-        ot_usec = ot.ot_usec;
-      }
+    inline bool
+    operator > (const time& t1, const time& t2)
+    {
+      if (t1.unix_time () > t2.unix_time ())
+        return true;
+      else if (t1.unix_time () < t2.unix_time ())
+        return false;
+      else if (t1.usec () > t2.usec ())
+        return true;
+      else
+        return false;
+    }
+
+    inline bool
+    operator >= (const time& t1, const time& t2)
+    {
+      return (t1 > t2 || t1 == t2);
+    }
 
-    return *this;
-  }
+    inline time
+    operator + (const time& t1, const time& t2)
+    {
+      return time (t1.unix_time () + t2.unix_time (),
+                          t1.usec () + t2.usec ());
+    }
 
-  ~octave_time (void) { }
+    class
+    OCTAVE_API
+    base_tm
+    {
+    public:
 
-  void stamp (void);
-
-  double double_value (void) const { return ot_unix_time + ot_usec / 1e6; }
+      base_tm (void)
+        : m_usec (0), m_sec (0), m_min (0), m_hour (0),
+          m_mday (0), m_mon (0), m_year (0), m_wday (0),
+          m_yday (0), m_isdst (0), m_gmtoff (0), m_zone ("unknown")
+        { }
 
-  time_t unix_time (void) const { return ot_unix_time; }
-
-  int usec (void) const { return ot_usec; }
+      base_tm (const base_tm& tm)
+        : m_usec (tm.m_usec), m_sec (tm.m_sec), m_min (tm.m_min),
+          m_hour (tm.m_hour), m_mday (tm.m_mday), m_mon (tm.m_mon),
+          m_year (tm.m_year), m_wday (tm.m_wday), m_yday (tm.m_yday),
+          m_isdst (tm.m_isdst), m_gmtoff (tm.m_gmtoff), m_zone (tm.m_zone)
+        { }
 
-  std::string ctime (void) const;
-
-private:
+      base_tm& operator = (const base_tm& tm)
+        {
+          if (this != &tm)
+            {
+              m_usec = tm.m_usec;
+              m_sec = tm.m_sec;
+              m_min = tm.m_min;
+              m_hour = tm.m_hour;
+              m_mday = tm.m_mday;
+              m_mon = tm.m_mon;
+              m_year = tm.m_year;
+              m_wday = tm.m_wday;
+              m_yday = tm.m_yday;
+              m_isdst = tm.m_isdst;
+              m_gmtoff = tm.m_gmtoff;
+              m_zone = tm.m_zone;
+            }
 
-  // Seconds since the epoch.
-  time_t ot_unix_time;
+          return *this;
+        }
+
+      virtual ~base_tm (void) { }
 
-  // Additional microseconds.
-  int ot_usec;
-};
+      int usec (void) const { return m_usec; }
+      int sec (void) const { return m_sec; }
+      int min (void) const { return m_min; }
+      int hour (void) const { return m_hour; }
+      int mday (void) const { return m_mday; }
+      int mon (void) const { return m_mon; }
+      int year (void) const { return m_year; }
+      int wday (void) const { return m_wday; }
+      int yday (void) const { return m_yday; }
+      int isdst (void) const { return m_isdst; }
+      long gmtoff (void) const { return m_gmtoff; }
+      std::string zone (void) const { return m_zone; }
 
-inline bool
-operator == (const octave_time& t1, const octave_time& t2)
-{
-  return (t1.unix_time () == t2.unix_time () && t1.usec () == t2.usec ());
-}
+      base_tm& usec (int v);
+      base_tm& sec (int v);
+      base_tm& min (int v);
+      base_tm& hour (int v);
+      base_tm& mday (int v);
+      base_tm& mon (int v);
+      base_tm& year (int v);
+      base_tm& wday (int v);
+      base_tm& yday (int v);
+      base_tm& isdst (int v);
+      base_tm& gmtoff (long v);
+      base_tm& zone (const std::string& s);
+
+      std::string strftime (const std::string& fmt) const;
+
+      std::string asctime (void) const
+      { return strftime ("%a %b %d %H:%M:%S %Y\n"); }
+
+    protected:
+
+      // Microseconds after the second (0, 999999).
+      int m_usec;
+
+      // Seconds after the minute (0, 61).
+      int m_sec;
 
-inline bool
-operator != (const octave_time& t1, const octave_time& t2)
-{
-  return ! (t1 == t2);
-}
+      // Minutes after the hour (0, 59).
+      int m_min;
+
+      // Hours since midnight (0, 23).
+      int m_hour;
+
+      // Day of the month (1, 31).
+      int m_mday;
+
+      // Months since January (0, 11).
+      int m_mon;
+
+      // Years since 1900.
+      int m_year;
+
+      // Days since Sunday (0, 6).
+      int m_wday;
+
+      // Days since January 1 (0, 365).
+      int m_yday;
+
+      // Daylight Savings Time flag.
+      int m_isdst;
+
+      // Time zone.
+      long m_gmtoff;
 
-inline bool
-operator < (const octave_time& t1, const octave_time& t2)
-{
-  if (t1.unix_time () < t2.unix_time ())
-    return true;
-  else if (t1.unix_time () > t2.unix_time ())
-    return false;
-  else if (t1.usec () < t2.usec ())
-    return true;
-  else
-    return false;
-}
+      // Time zone.
+      std::string m_zone;
+
+      void init (void *p);
+    };
+
+    class
+    OCTAVE_API
+    localtime : public base_tm
+    {
+    public:
+
+      localtime (void)
+        : base_tm () { init (time ()); }
+
+      localtime (const time& ot)
+        : base_tm () { init (ot); }
+
+      localtime (const localtime& t)
+        : base_tm (t) { }
 
-inline bool
-operator <= (const octave_time& t1, const octave_time& t2)
-{
-  return (t1 < t2 || t1 == t2);
-}
+      localtime& operator = (const localtime& t)
+        {
+          base_tm::operator = (t);
+          return *this;
+        }
+
+      ~localtime (void) { }
+
+    private:
+
+      void init (const time& ot);
+    };
+
+    class
+    OCTAVE_API
+    gmtime : public base_tm
+    {
+    public:
+
+      gmtime (void)
+        : base_tm () { init (time ()); }
+
+      gmtime (const time& ot)
+        : base_tm () { init (ot); }
 
-inline bool
-operator > (const octave_time& t1, const octave_time& t2)
-{
-  if (t1.unix_time () > t2.unix_time ())
-    return true;
-  else if (t1.unix_time () < t2.unix_time ())
-    return false;
-  else if (t1.usec () > t2.usec ())
-    return true;
-  else
-    return false;
-}
+      gmtime& operator = (const gmtime& t)
+        {
+          base_tm::operator = (t);
+          return *this;
+        }
+
+      ~gmtime (void) { }
+
+    private:
+
+      void init (const time& ot);
+    };
+
+    class
+    OCTAVE_API
+    strptime : public base_tm
+    {
+    public:
 
-inline bool
-operator >= (const octave_time& t1, const octave_time& t2)
-{
-  return (t1 > t2 || t1 == t2);
-}
+      strptime (const std::string& str, const std::string& fmt)
+        : base_tm (), nchars (0)
+        {
+          init (str, fmt);
+        }
+
+      strptime (const strptime& s)
+        : base_tm (s), nchars (s.nchars) { }
 
-inline octave_time
-operator + (const octave_time& t1, const octave_time& t2)
-{
-  return octave_time (t1.unix_time () + t2.unix_time (),
-                      t1.usec () + t2.usec ());
+      strptime& operator = (const strptime& s)
+        {
+          base_tm::operator = (s);
+          nchars = s.nchars;
+          return *this;
+        }
+
+      int characters_converted (void) const { return nchars; }
+
+      ~strptime (void) { }
+
+    private:
+
+      int nchars;
+
+      void init (const std::string& str, const std::string& fmt);
+    };
+  }
 }
 
-class
-OCTAVE_API
-octave_base_tm
-{
-public:
-
-  octave_base_tm (void)
-    : tm_usec (0), tm_sec (0), tm_min (0), tm_hour (0),
-      tm_mday (0), tm_mon (0), tm_year (0), tm_wday (0),
-      tm_yday (0), tm_isdst (0), tm_gmtoff (0), tm_zone ("unknown")
-  { }
-
-  octave_base_tm (const octave_base_tm& tm)
-    : tm_usec (tm.tm_usec), tm_sec (tm.tm_sec), tm_min (tm.tm_min),
-      tm_hour (tm.tm_hour), tm_mday (tm.tm_mday), tm_mon (tm.tm_mon),
-      tm_year (tm.tm_year), tm_wday (tm.tm_wday), tm_yday (tm.tm_yday),
-      tm_isdst (tm.tm_isdst), tm_gmtoff (tm.tm_gmtoff), tm_zone (tm.tm_zone)
-  { }
-
-  octave_base_tm& operator = (const octave_base_tm& tm)
-  {
-    if (this != &tm)
-      {
-        tm_usec = tm.tm_usec;
-        tm_sec = tm.tm_sec;
-        tm_min = tm.tm_min;
-        tm_hour = tm.tm_hour;
-        tm_mday = tm.tm_mday;
-        tm_mon = tm.tm_mon;
-        tm_year = tm.tm_year;
-        tm_wday = tm.tm_wday;
-        tm_yday = tm.tm_yday;
-        tm_isdst = tm.tm_isdst;
-        tm_gmtoff = tm.tm_gmtoff;
-        tm_zone = tm.tm_zone;
-      }
-
-    return *this;
-  }
-
-  virtual ~octave_base_tm (void) { }
+#if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS)
 
-  int usec (void) const { return tm_usec; }
-  int sec (void) const { return tm_sec; }
-  int min (void) const { return tm_min; }
-  int hour (void) const { return tm_hour; }
-  int mday (void) const { return tm_mday; }
-  int mon (void) const { return tm_mon; }
-  int year (void) const { return tm_year; }
-  int wday (void) const { return tm_wday; }
-  int yday (void) const { return tm_yday; }
-  int isdst (void) const { return tm_isdst; }
-  long gmtoff (void) const { return tm_gmtoff; }
-  std::string zone (void) const { return tm_zone; }
-
-  octave_base_tm& usec (int v);
-  octave_base_tm& sec (int v);
-  octave_base_tm& min (int v);
-  octave_base_tm& hour (int v);
-  octave_base_tm& mday (int v);
-  octave_base_tm& mon (int v);
-  octave_base_tm& year (int v);
-  octave_base_tm& wday (int v);
-  octave_base_tm& yday (int v);
-  octave_base_tm& isdst (int v);
-  octave_base_tm& gmtoff (long v);
-  octave_base_tm& zone (const std::string& s);
-
-  std::string strftime (const std::string& fmt) const;
+OCTAVE_DEPRECATED ("use octave::sys::time instead")
+typedef octave::sys::time octave_time;
 
-  std::string asctime (void) const
-  { return strftime ("%a %b %d %H:%M:%S %Y\n"); }
-
-protected:
-
-  // Microseconds after the second (0, 999999).
-  int tm_usec;
-
-  // Seconds after the minute (0, 61).
-  int tm_sec;
-
-  // Minutes after the hour (0, 59).
-  int tm_min;
-
-  // Hours since midnight (0, 23).
-  int tm_hour;
-
-  // Day of the month (1, 31).
-  int tm_mday;
-
-  // Months since January (0, 11).
-  int tm_mon;
-
-  // Years since 1900.
-  int tm_year;
-
-  // Days since Sunday (0, 6).
-  int tm_wday;
+OCTAVE_DEPRECATED ("use octave::sys::base_tm instead")
+typedef octave::sys::base_tm octave_base_tm;
 
-  // Days since January 1 (0, 365).
-  int tm_yday;
-
-  // Daylight Savings Time flag.
-  int tm_isdst;
-
-  // Time zone.
-  long tm_gmtoff;
-
-  // Time zone.
-  std::string tm_zone;
-
-  void init (void *p);
-};
-
-class
-OCTAVE_API
-octave_localtime : public octave_base_tm
-{
-public:
-
-  octave_localtime (void)
-    : octave_base_tm () { init (octave_time ()); }
-
-  octave_localtime (const octave_time& ot)
-    : octave_base_tm () { init (ot); }
-
-  octave_localtime (const octave_localtime& t)
-    : octave_base_tm (t) { }
-
-  octave_localtime& operator = (const octave_localtime& t)
-  {
-    octave_base_tm::operator = (t);
-    return *this;
-  }
-
-  ~octave_localtime (void) { }
-
-private:
-
-  void init (const octave_time& ot);
-};
-
-class
-OCTAVE_API
-octave_gmtime : public octave_base_tm
-{
-public:
+OCTAVE_DEPRECATED ("use octave::sys::localtime instead")
+typedef octave::sys::localtime octave_localtime;
 
-  octave_gmtime (void)
-    : octave_base_tm () { init (octave_time ()); }
-
-  octave_gmtime (const octave_time& ot)
-    : octave_base_tm () { init (ot); }
-
-  octave_gmtime& operator = (const octave_gmtime& t)
-  {
-    octave_base_tm::operator = (t);
-    return *this;
-  }
-
-  ~octave_gmtime (void) { }
-
-private:
-
-  void init (const octave_time& ot);
-};
-
-class
-OCTAVE_API
-octave_strptime : public octave_base_tm
-{
-public:
+OCTAVE_DEPRECATED ("use octave::sys::gmtime instead")
+typedef octave::sys::gmtime octave_gmtime;
 
-  octave_strptime (const std::string& str, const std::string& fmt)
-    : octave_base_tm (), nchars (0)
-  {
-    init (str, fmt);
-  }
-
-  octave_strptime (const octave_strptime& s)
-    : octave_base_tm (s), nchars (s.nchars) { }
-
-  octave_strptime& operator = (const octave_strptime& s)
-  {
-    octave_base_tm::operator = (s);
-    nchars = s.nchars;
-    return *this;
-  }
-
-  int characters_converted (void) const { return nchars; }
-
-  ~octave_strptime (void) { }
-
-private:
-
-  int nchars;
-
-  void init (const std::string& str, const std::string& fmt);
-};
+OCTAVE_DEPRECATED ("use octave::sys::strptime instead")
+typedef octave::sys::strptime octave_strptime;
 
 #endif
+
+#endif
--- a/liboctave/util/cmd-edit.cc	Wed May 18 13:11:15 2016 -0400
+++ b/liboctave/util/cmd-edit.cc	Wed May 18 15:23:05 2016 -0400
@@ -1611,7 +1611,7 @@
             case 'A':
               // Make the current time/date into a string.
               {
-                octave_localtime now;
+                octave::sys::localtime now;
 
                 if (c == 'd')
                   tmpstr = now.strftime ("%a %b %d");
--- a/liboctave/util/oct-shlib.h	Wed May 18 13:11:15 2016 -0400
+++ b/liboctave/util/oct-shlib.h	Wed May 18 15:23:05 2016 -0400
@@ -72,7 +72,7 @@
 
     static shlib_rep *get_instance (const std::string& f, bool fake);
 
-    octave_time time_loaded (void) const
+    octave::sys::time time_loaded (void) const
     { return tm_loaded; }
 
     std::string file_name (void) const
@@ -95,7 +95,7 @@
     void fake_reload (void);
 
     std::string file;
-    octave_time tm_loaded;
+    octave::sys::time tm_loaded;
 
     // Set of hooked function names.
     typedef std::map<std::string, size_t>::iterator fcn_names_iterator;
@@ -183,7 +183,7 @@
   std::string file_name (void) const
   { return rep->file_name (); }
 
-  octave_time time_loaded (void) const
+  octave::sys::time time_loaded (void) const
   { return rep->time_loaded (); }
 
 private: