annotate scripts/miscellaneous/toc.m @ 898:4733b101ce3f

[project @ 1994-11-09 18:04:15 by jwe] Initial revision
author jwe
date Wed, 09 Nov 1994 18:04:15 +0000
parents
children 3f257ab07921
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
898
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
1 # Copyright (C) 1994 John W. Eaton
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
2 #
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
3 # This file is part of Octave.
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
4 #
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
5 # Octave is free software; you can redistribute it and/or modify it
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
6 # under the terms of the GNU General Public License as published by the
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
7 # Free Software Foundation; either version 2, or (at your option) any
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
8 # later version.
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
9 #
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
10 # Octave is distributed in the hope that it will be useful, but WITHOUT
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
13 # for more details.
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
14 #
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
15 # You should have received a copy of the GNU General Public License
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
16 # along with Octave; see the file COPYING. If not, write to the Free
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
17 # Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
18
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
19 function secs = toc ()
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
20
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
21 # usage: toc
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
22 #
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
23 # Return the difference between the current wall-clock time and the
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
24 # time that the function tic () was last called, in seconds.
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
25 #
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
26 # See also: tic, clock, etime, cputime
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
27
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
28 if (nargin != 0)
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
29 warning ("toc: ignoring extra arguments");
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
30 endif
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
31
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
32 global _time_tic_called;
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
33
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
34 if (exist ("_time_tic_called"))
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
35 secs = etime (clock (), _time_tic_called);
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
36 else
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
37 warning ("toc called before timer set");
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
38 secs = [];
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
39 endif
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
40
4733b101ce3f [project @ 1994-11-09 18:04:15 by jwe]
jwe
parents:
diff changeset
41 endfunction