octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #54695] toc before tic


From: Ceral Paquet
Subject: [Octave-bug-tracker] [bug #54695] toc before tic
Date: Wed, 19 Sep 2018 15:20:15 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0

URL:
  <https://savannah.gnu.org/bugs/?54695>

                 Summary: toc before tic
                 Project: GNU Octave
            Submitted by: octavebugs
            Submitted on: Wed 19 Sep 2018 07:20:13 PM UTC
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Feature Request
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.4.1
        Operating System: Any

    _______________________________________________________

Details:

It has always been a minor irritation for me in MATLAB that the "toc" command
errors out when called before "tic". It prevents the use of this one-liner
when timing loops.

++
for k = 1:10

   pause(1); % do some work
   fprintf('Pass %i: ',k); toc; tic

end
--

Just putting it out there as a possible divergence from MATLAB to default to
the start of time (0).

++
function t = toc(varargin)

% stop toc from erroring out if called before tic.

if nargin==0
    varargin{1} = uint64(0);
end

if nargout==0
    builtin('toc',varargin{:});
else
    t = builtin('toc',varargin{:});
end
--verbatin--





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?54695>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]