2002-10-03
2002-10-03 17:23:38 by Martin Stjernholm <mast@lysator.liu.se>
-
f917a38fe8623095f055d95e260aa2abede37629
(19 lines)
(+7/-12)
[
Show
| Annotate
]
Branch: 7.9
It's better to throw errors than return zero if ctime(), localtime() or
gmtime() fails.
Rev: src/builtin.cmod:1.92
Rev: src/builtin_functions.c:1.442
5:
\*/
/**/
#include "global.h"
- RCSID("$Id: builtin_functions.c,v 1.441 2002/10/03 15:23:34 mast Exp $");
+ RCSID("$Id: builtin_functions.c,v 1.442 2002/10/03 17:23:38 mast Exp $");
#include "interpret.h"
#include "svalue.h"
#include "pike_macros.h"
4020: Inside #if defined(HAVE_GMTIME)
t = tt;
tm = gmtime(&t);
+ if (!tm) Pike_error ("gmtime() on this system cannot handle "
+ "the timestamp %ld.\n", (long) t);
pop_n_elems(args);
-
- if (!tm) {
- push_int (0);
- return;
- }
+
encode_struct_tm(tm);
push_string(make_shared_string("timezone"));
4064: Inside #if defined(HAVE_LOCALTIME)
*! Offset from UTC.
*! @endmapping
*!
- *! Zero is returned if the localtime(2) call failed on the system.
+ *! An error is thrown if the localtime(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].
*!
4084: Inside #if defined(HAVE_LOCALTIME)
t = tt;
tm = localtime(&t);
+ if (!tm) Pike_error ("localtime() on this system cannot handle "
+ "the timestamp %ld.\n", (long) t);
pop_n_elems(args);
-
- if (!tm) {
- push_int (0);
- return;
- }
+
encode_struct_tm(tm);
#ifdef STRUCT_TM_HAS_GMTOFF