2847
|
1 ## Copyright (C) 1996, 1997 John W. Eaton |
2313
|
2 ## |
|
3 ## This file is part of Octave. |
|
4 ## |
|
5 ## Octave is free software; you can redistribute it and/or modify it |
|
6 ## under the terms of the GNU General Public License as published by |
|
7 ## the Free Software Foundation; either version 2, or (at your option) |
|
8 ## any later version. |
|
9 ## |
|
10 ## Octave is distributed in the hope that it will be useful, but |
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 ## General Public License for more details. |
|
14 ## |
|
15 ## You should have received a copy of the GNU General Public License |
|
16 ## along with Octave; see the file COPYING. If not, write to the Free |
|
17 ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA |
|
18 ## 02111-1307, USA. |
1183
|
19 |
3295
|
20 ## -*- texinfo -*- |
|
21 ## @deftypefn {Function File} {} ctime (@var{t}) |
|
22 ## Convert a value returned from @code{time} (or any other nonnegative |
|
23 ## integer), to the local time and return a string of the same form as |
|
24 ## @code{asctime}. The function @code{ctime (time)} is equivalent to |
|
25 ## @code{asctime (localtime (time))}. For example, |
3426
|
26 ## |
3295
|
27 ## @example |
|
28 ## @group |
|
29 ## ctime (time ()) |
|
30 ## @result{} "Mon Feb 17 01:15:06 1997" |
|
31 ## @end group |
|
32 ## @end example |
|
33 ## @end deftypefn |
1183
|
34 |
2314
|
35 ## Author: jwe |
|
36 |
2311
|
37 function retval = ctime (t) |
1183
|
38 |
|
39 if (nargin == 1) |
|
40 retval = asctime (localtime (t)); |
|
41 else |
1382
|
42 usage ("ctime (TIME)"); |
1183
|
43 endif |
|
44 |
|
45 endfunction |