static uint64_t mc_event_get_time() { struct timeval tv; mc_gettimeofday(&tv, NULL); return (uint64_t)tv.tv_sec * 1000 + tv.tv_usec / 1000; }
void xs_system_get_time(xsMachine *the) { double t; struct timeval tv; mc_gettimeofday(&tv, NULL); t = tv.tv_sec * 1000 + tv.tv_usec / 1000; xsSetNumber(xsResult, t); }
void xs_system_get_timezone(xsMachine *the) { struct timezone tz; xsVars(1); mc_gettimeofday(NULL, &tz); xsResult = xsNewInstanceOf(xsObjectPrototype); xsSetInteger(xsVar(0), tz.tz_minuteswest); xsSet(xsResult, xsID("timedifference"), xsVar(0)); xsSetInteger(xsVar(0), tz.tz_dsttime); xsSet(xsResult, xsID("dst"), xsVar(0)); }