pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:1:   /* -*- c -*- -  * $Id: builtin.cmod,v 1.28 2002/10/03 16:04:53 mast Exp $ +  * $Id: builtin.cmod,v 1.29 2002/10/03 17:23:28 mast Exp $    */      #include "global.h"   #include "interpret.h"   #include "svalue.h"   #include "opcodes.h"   #include "pike_macros.h"   #include "object.h"   #include "program.h"   #include "array.h"
pike.git/src/builtin.cmod:109:    optflags OPT_SIDE_EFFECT;   {    pop_n_elems(args);    push_int(t_flag);    t_flag=t;   }      //! Convert the output from a previous call to @[time()] into a readable   //! string containing the current year, month, day and time.   //! - //! Like @[localtime], this function might return zero if the ctime(2) - //! call failed on the system. It's platform dependent what time - //! ranges that function can handle, e.g. Windows doesn't handle a - //! negative @[timestamp]. + //! Like @[localtime], this function might throw an error if the + //! ctime(2) call failed on the system. It's platform dependent what + //! time ranges that function can handle, e.g. Windows doesn't handle + //! a negative @[timestamp].   //!   //! @seealso   //! @[time()], @[localtime()], @[mktime()], @[gmtime()]   //!   PIKEFUN string ctime(int timestamp)    efun;    optflags OPT_TRY_OPTIMIZE;   {    time_t i=(time_t)timestamp;    char *s = ctime (&i); -  if (!s) { -  pop_stack(); -  push_int (0); -  return; -  } +  if (!s) Pike_error ("ctime() on this system cannot handle " +  "the timestamp %ld.\n", (long) i);    RETURN make_shared_string(s);   }      //! Make a mapping from two arrays.   //!   //! Makes a mapping @[ind[x]]:@[val[x]], @tt{0 <= x < sizeof(ind)@}.   //!   //! @[ind] and @[val] must have the same size.   //!   //! This is the inverse operation of @[indices()] and @[values()].