Xenofarm machine: motoko.roxen.com (maybe others too) Git pike 8.1
Case in point: In the testsuite I created two entries:
test_eq(mktime (33, 3, 12, 14, 6, 117, 0, 0), 1500033813); test_eq(mktime ((["sec":33, "min":3, "hour":12, "mday":14, "mon":6, "year":117, "timezone":0])), 1500033813);
They should be equivalent. And they are (on other machines), but on this machine, they differ because of this code segment in src/builtin_functions.c (code shortened for readability, irrelevant parts omitted): ------------------------------------------ PMOD_EXPORT void f_mktime (INT32 args) { if(args == 1) { push_static_text("sec"); push_static_text("min"); push_static_text("hour"); push_static_text("mday"); push_static_text("mon"); push_static_text("year"); push_static_text("isdst"); push_static_text("timezone"); f_aggregate(8); f_rows(2); Pike_sp--; dmalloc_touch_svalue(Pike_sp); push_array_items(Pike_sp->u.array); args=8; }
get_all_args("mktime",args, "%i%i%i%i%i%i.%i%i", &sec, &min, &hour, &mday, &mon, &year, &isdst, &tz);
if((args > 7) && (SUBTYPEOF(Pike_sp[7-args]) == NUMBER_NUMBER)) { ------------------------------------------
It appears that when mktime() is called using 8 direct arguments, it works fine and (SUBTYPEOF(Pike_sp[7-args]) == NUMBER_NUMBER evaluates to true.
However, if mktime() is called using a mapping as sole argument, it works fine on most machines, but on motoko/SunOS 5.1 then (SUBTYPEOF(Pike_sp[7-args]) == NUMBER_NUMBER evaluates to false?
Any clues? I want to avoid debugging this through successive approximation and xenofarm.
NUMBER_NUMBER seems to be defined to 0, BTW.