diff scripts/time/ctime.m @ 13856:d490ca8ab1a5

Modernize function implementations and docstrings in scripts/time. * addtodate.m: Add millisecond functionality. Update docstring and %!tests. * calendar.m: Implement faster way to add '*' to day display. Update docstring. * weekday.m: Use more modern coding stytle. Update docstring. * asctime.m, clock.m, ctime.m, date.m, datenum.m, datestr.m, datevec.m, eomday.m, etime.m, is_leap_year.m: Update docstring and/or use Octave formatting spacing conventions for %!tests.
author Rik <octave@nomad.inbox5.com>
date Thu, 10 Nov 2011 13:35:08 -0800
parents fd0a3ac60b0e
children 72c96de7a403
line wrap: on
line diff
--- a/scripts/time/ctime.m	Thu Nov 10 02:50:51 2011 -0500
+++ b/scripts/time/ctime.m	Thu Nov 10 13:35:08 2011 -0800
@@ -26,28 +26,29 @@
 ## @example
 ## @group
 ## ctime (time ())
-##      @result{} "Mon Feb 17 01:15:06 1997\n"
+##      @result{} "Mon Feb 17 01:15:06 1997"
 ## @end group
 ## @end example
+## @seealso{asctime, time, localtime}
 ## @end deftypefn
 
 ## Author: jwe
 
 function retval = ctime (t)
 
-  if (nargin == 1)
-    retval = asctime (localtime (t));
-  else
+  if (nargin != 1)
     print_usage ();
   endif
 
+  retval = asctime (localtime (t));
+
 endfunction
 
+
 %!test
 %! t = time ();
 %! assert(strcmp (asctime (localtime (t)), ctime (t)));
 
 %!error ctime ();
-
 %!error ctime (1, 2);